:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #fbfcfe;
  --text: #171a20;
  --muted: #69707d;
  --line: #dde2ea;
  --line-strong: #cbd3df;
  --brand: #1268d6;
  --brand-dark: #0f4fa6;
  --danger: #cf1f35;
  --shadow: 0 24px 70px rgba(26, 36, 58, 0.08);
  --radius: 8px;
  --radius-sm: 7px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1018;
  --panel: #111827;
  --panel-soft: #0f172a;
  --text: #e8edf7;
  --muted: #9aa8bd;
  --line: rgba(148, 163, 184, 0.24);
  --line-strong: rgba(148, 163, 184, 0.38);
  --brand: #64a8ff;
  --brand-dark: #3b8af0;
  --danger: #ff6b7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(circle at top right, rgba(18, 104, 214, 0.08), transparent 30rem), var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}

:root[data-theme="dark"] body {
  background: radial-gradient(circle at top right, rgba(100, 168, 255, 0.16), transparent 30rem), var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 76px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 247, 249, 0.9);
  border-bottom: 1px solid rgba(221, 226, 234, 0.85);
  backdrop-filter: blur(16px);
}

.site-nav {
  width: min(1180px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 24px;
}

.nav-right {
  display: contents;
  min-width: 0;
}

.brand,
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.brand {
  justify-self: start;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: block;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
}

.nav-links {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  white-space: nowrap;
}

.nav-actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
  white-space: nowrap;
}

.theme-toggle {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
  font-size: 12px;
  font-weight: 720;
}

.theme-toggle {
  width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.theme-toggle:hover {
  border-color: rgba(18, 104, 214, 0.32);
}

.theme-glyph {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: inset -4px -2px 0 rgba(255, 255, 255, 0.58);
}

.nav-links a,
.nav-menu-trigger {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
}

.nav-links a:hover,
.nav-links a[aria-current="page"],
.nav-menu-trigger:hover,
.nav-menu-trigger[aria-current="page"] {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.nav-menu {
  position: relative;
  padding-bottom: 10px;
  margin-bottom: -10px;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 40;
  width: 220px;
  display: none;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(26, 36, 58, 0.12);
}

.nav-dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.nav-menu:hover .nav-dropdown,
.nav-menu:focus-within .nav-dropdown {
  display: grid;
}

.nav-dropdown a,
.nav-dropdown span {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.nav-dropdown span {
  color: #9aa3b2;
  cursor: default;
}

:root[data-theme="dark"] .site-header {
  background: rgba(11, 16, 24, 0.88);
  border-bottom-color: rgba(148, 163, 184, 0.22);
}

:root[data-theme="dark"] .nav-links a:hover,
:root[data-theme="dark"] .nav-links a[aria-current="page"],
:root[data-theme="dark"] .nav-menu-trigger:hover,
:root[data-theme="dark"] .nav-menu-trigger[aria-current="page"],
:root[data-theme="dark"] .nav-dropdown,
:root[data-theme="dark"] .theme-toggle {
  background: rgba(17, 24, 39, 0.94);
  border-color: var(--line);
}

:root[data-theme="dark"] .nav-dropdown {
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .nav-dropdown span {
  color: #6f7f97;
}

:root[data-theme="dark"] .theme-glyph {
  background: #f8fafc;
  box-shadow: inset -5px -2px 0 rgba(100, 168, 255, 0.62);
}

.hero,
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 42px;
}

.page-hero {
  display: block;
  max-width: 860px;
}

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

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

.hero-copy,
.hero-advantage-card,
.hero-panel,
.section-block,
.document-form,
.preview-panel,
.article-body {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-panel {
  padding: 34px;
}

.hero-advantage-card {
  display: grid;
  gap: 12px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.86);
}

.hero-advantage-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-advantage-card span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.hero-copy h1,
.page-hero h1 {
  margin: 8px 0 14px;
  max-width: 780px;
  font-size: clamp(38px, 5.1vw, 58px);
  line-height: 1.03;
  letter-spacing: 0;
}

.page-hero h1 {
  font-size: clamp(38px, 5vw, 58px);
}

.hero-copy p,
.page-hero p {
  max-width: 740px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.hero-panel {
  display: grid;
  align-content: center;
  gap: 12px;
  background: #fff;
}

.hero-panel span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.hero-panel strong {
  max-width: 500px;
  font-size: 26px;
  line-height: 1.2;
}

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

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

.hero-tool-list a {
  display: grid;
  gap: 3px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.hero-tool-list a:first-child {
  border-top: 0;
}

.hero-tool-list a strong {
  font-size: 16px;
}

.hero-tool-list a small {
  color: var(--muted);
  font-size: 13px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 720;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.06);
  text-align: center;
  white-space: normal;
}

.button:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  background: var(--brand-dark);
}

.button.secondary {
  background: #fff;
}

.button.ghost {
  box-shadow: none;
  background: transparent;
}

.button.danger {
  color: var(--danger);
  border-color: rgba(207, 31, 53, 0.22);
  background: #fff;
}

.button.small {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.section-block {
  margin-top: 26px;
  padding: 28px;
}

.section-head {
  max-width: 760px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 4px 0 8px;
  font-size: 30px;
  line-height: 1.15;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

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

.tool-card,
.feature-card {
  min-height: 168px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.feature-card.compact {
  min-height: 88px;
  align-content: center;
}

.tool-card:hover,
.feature-card:hover {
  border-color: rgba(18, 104, 214, 0.34);
  transform: translateY(-2px);
}

.tool-card span,
.feature-card span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.tool-card strong,
.feature-card strong {
  font-size: 18px;
  line-height: 1.25;
}

.tool-card p,
.feature-card p {
  margin: 0;
  color: var(--muted);
}

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

.guide-card {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(26, 36, 58, 0.06);
}

.guide-card:hover {
  border-color: rgba(18, 104, 214, 0.32);
  transform: translateY(-2px);
}

.guide-card strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
}

.guide-card span {
  margin-top: 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 760;
}

.text-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--brand);
  font-weight: 760;
}

.guide-all-link {
  margin-top: 18px;
}

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

.category-card,
.knowledge-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(26, 36, 58, 0.06);
}

.category-card h3,
.knowledge-card strong {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.category-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.category-card li {
  padding-left: 14px;
  position: relative;
}

.category-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--brand);
}

.knowledge-card {
  min-height: 290px;
}

.knowledge-card:hover {
  border-color: rgba(18, 104, 214, 0.32);
  transform: translateY(-2px);
}

.knowledge-card p {
  margin: 0;
  color: var(--muted);
}

.knowledge-card > span {
  margin-top: auto;
  color: var(--brand);
  font-size: 13px;
  font-weight: 760;
}

.guide-visual {
  min-height: 132px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff, #fff);
}

.guide-visual-document {
  align-content: start;
}

.visual-doc-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #1d3153;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.visual-doc-row,
.visual-doc-total {
  height: 10px;
  border-radius: 999px;
  background: #dfe7f4;
}

.visual-doc-row.wide {
  width: 100%;
}

.visual-doc-row {
  width: 74%;
}

.visual-doc-row.short {
  width: 48%;
}

.visual-doc-total {
  width: 38%;
  margin-top: 8px;
  margin-left: auto;
  background: #1268d6;
}

.guide-visual-flow {
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
}

.guide-visual-flow span,
.guide-visual-compare div {
  display: grid;
  place-items: center;
  min-height: 72px;
  padding: 10px;
  border: 1px solid #dce5f2;
  border-radius: 10px;
  background: #fff;
  color: #1d3153;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.guide-visual-flow i {
  width: 18px;
  height: 2px;
  display: block;
  background: #9aa8bd;
}

.guide-visual-compare {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-visual-compare div {
  align-content: center;
  gap: 5px;
  place-items: stretch;
}

.guide-visual-compare strong {
  font-size: 13px;
}

.guide-visual-compare span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: center;
  margin-bottom: 26px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.article-hero h1 {
  margin: 8px 0 14px;
  max-width: 780px;
  font-size: clamp(36px, 4.6vw, 54px);
  line-height: 1.04;
}

.article-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.knowledge-article-body ul {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.article-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.article-cta h2 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.article-cta p {
  margin: 0;
  color: var(--muted);
}

.tool-layout {
  display: grid;
  width: min(1320px, calc(100vw - 40px));
  margin-left: 50%;
  transform: translateX(-50%);
  grid-template-columns: minmax(680px, 1fr) 420px;
  gap: 24px;
  align-items: start;
}

.document-form,
.preview-panel {
  padding: 24px;
}

.document-form {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.preview-panel {
  position: sticky;
  top: 84px;
  padding: 16px 6px 8px;
  overflow: hidden;
}

.form-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.form-group h2,
.group-title-row h2 {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.25;
}

.group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

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

.header-field-grid {
  align-items: end;
}

.logo-upload-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.logo-upload-field label {
  min-width: 0;
}

.logo-upload-field small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.logo-file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.logo-upload-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.editor-paper {
  display: grid;
  gap: 34px;
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #1d3153;
}

.editor-paper label {
  gap: 7px;
  color: #66748f;
  font-size: 12px;
  font-weight: 700;
}

.editor-paper label > span,
.editor-table-head span {
  color: #1d3153;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.editor-paper input,
.editor-paper select,
.editor-paper textarea {
  min-height: 38px;
  border-color: #d5deeb;
  border-radius: 6px;
  color: #172033;
  font-size: 13px;
  font-weight: 600;
}

.editor-paper textarea {
  min-height: 72px;
  overflow: hidden;
  line-height: 1.45;
  resize: none;
}

.editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 40px;
  align-items: start;
}

.editor-title-block {
  display: grid;
  gap: 12px;
}

.editor-title-input {
  min-height: 56px !important;
  border-color: transparent !important;
  padding: 0 !important;
  color: #3f444a !important;
  font-size: 34px !important;
  font-weight: 800 !important;
  line-height: 1.05;
  background: transparent !important;
}

.editor-number-row,
.editor-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.editor-logo-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
  justify-items: center;
  justify-self: end;
  min-width: 150px;
}

.editor-logo-block label {
  align-items: center;
}

.editor-logo-block label > span:first-child {
  justify-self: center;
}

.editor-logo-block .logo-upload-button {
  width: 96px;
  height: 96px;
  min-height: 96px;
  border-color: #9ec5ff;
  border-radius: 999px;
  background: #f8fbff;
  color: #006ee6;
  text-align: center;
}

.editor-logo-block small {
  color: #72809c;
  font-size: 12px;
  text-align: center;
}

.editor-logo-block .logo-help {
  max-width: 180px;
  margin-top: 2px;
  color: #66748f;
  font-size: 11px;
  line-height: 1.35;
}

.editor-logo-block [data-remove-logo] {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  box-shadow: none;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
}

.editor-logo-block [data-remove-logo]:hover {
  color: #a1121c;
  background: transparent;
  transform: none;
}

.editor-logo-block [data-remove-logo][hidden] {
  display: none;
}

.editor-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 48px;
  align-items: start;
}

.editor-panel {
  display: contents;
}

.editor-panel > * {
  align-self: start;
}

.editor-panel:first-child > :nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.editor-panel:first-child > :nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.editor-panel:first-child > :nth-child(3) {
  grid-column: 1;
  grid-row: 3;
}

.editor-panel:first-child > :nth-child(4) {
  grid-column: 1;
  grid-row: 4;
}

.editor-panel:nth-child(2) > :nth-child(1) {
  grid-column: 2;
  grid-row: 1;
}

.editor-panel:nth-child(2) > :nth-child(2) {
  grid-column: 2;
  grid-row: 2;
}

.editor-panel:nth-child(2) > :nth-child(3) {
  grid-column: 2;
  grid-row: 3;
}

.editor-panel:nth-child(2) > :nth-child(4) {
  grid-column: 2;
  grid-row: 4;
}

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

.editor-meta-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.editor-items {
  display: grid;
  gap: 10px;
  --items-grid: minmax(180px, 1fr) 80px 120px 126px 38px;
}

.editor-table-head {
  display: grid;
  grid-template-columns: var(--items-grid);
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-radius: 4px;
  background: #f3f5f8;
}

.editor-table-head span:not(:first-child) {
  text-align: right;
}

.editor-table-head [data-editable-label]:not(:first-child) {
  justify-content: flex-end;
}

.editor-table-head [data-field="amountLabel"] {
  grid-column: 4 / 6;
}

.editor-table-head [data-editable-label] {
  position: relative;
  min-width: 0;
  max-width: 100%;
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.68);
  outline: none;
  cursor: text;
  overflow-wrap: anywhere;
}

.editor-table-head [data-editable-label]::after {
  content: "Edit";
  position: absolute;
  right: 0;
  top: -24px;
  z-index: 2;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #7b8798;
  font-size: 9px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
}

.editor-table-head [data-editable-label]:hover {
  border-color: #9fb2cc;
  background: #fff;
}

.editor-table-head [data-editable-label]:hover::after,
.editor-table-head [data-editable-label]:focus::after {
  opacity: 1;
}

.editor-table-head [data-editable-label]:focus {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--brand), 0 0 0 3px rgba(18, 104, 214, 0.1);
}

.editor-table-head::after {
  content: "";
  display: none;
}

.editor-items .line-item-row {
  grid-template-columns: var(--items-grid);
  gap: 10px;
  padding: 0 14px;
  border: 0;
  background: transparent;
}

.editor-items .line-item-row label > span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.editor-items .line-number {
  display: none;
}

.editor-items .icon-button {
  align-self: end;
}

.item-description-input {
  width: 100%;
  min-width: 220px;
  max-width: 100%;
}

.line-amount {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 0;
  color: #1d3153;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.editor-add-line {
  justify-self: end;
}

.editor-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  padding-top: 20px;
  border-top: 1px solid #d8dee8;
}

.editor-totals-panel {
  display: grid;
  gap: 10px;
}

.editor-total-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 14px;
  align-items: center;
  color: #66748f;
}

.editor-total-line > span:first-child {
  color: #1d3153;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.editor-total-line input {
  min-height: 36px;
  text-align: right;
}

.editor-total-line strong {
  color: #1d3153;
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.editor-total-line.grand {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #d8dee8;
}

.editor-total-line.grand strong {
  font-size: 22px;
}

.editor-tax-amount {
  margin-top: -4px;
}

.editor-tax-amount > span:first-child,
.editor-tax-amount strong {
  color: #72809c;
  font-size: 11px;
}

.suffix-input {
  position: relative;
  display: block;
}

.suffix-input input {
  padding-right: 30px;
}

.suffix-input span {
  position: absolute;
  top: 50%;
  right: 11px;
  color: #72809c;
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
  pointer-events: none;
}

.editor-notes {
  width: min(100%, 520px);
  display: grid;
  gap: 18px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 88px;
  overflow: hidden;
  line-height: 1.45;
  resize: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 104, 214, 0.12);
}

.line-items {
  display: grid;
  gap: 10px;
}

.line-item-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 80px 120px 100px 40px;
  gap: 10px;
  align-items: end;
  padding: 14px 14px 14px 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.line-number {
  position: absolute;
  left: 14px;
  top: 16px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-size: 20px;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.action-help-card {
  width: min(430px, 100%);
  display: grid;
  gap: 5px;
  margin: 0 auto 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.04);
  font-size: 13px;
  line-height: 1.45;
}

.action-help-card strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
}

.action-help-card b {
  color: var(--text);
  font-weight: 760;
}

.preview-actions {
  width: min(430px, 100%);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 0 auto 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.preview-actions .button {
  min-height: 32px;
  padding: 5px 4px;
  border-radius: 6px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
  transform: none;
}

.preview-actions .button:hover {
  transform: none;
}

.preview-actions .button.primary {
  background: #1268d6;
}

.preview-actions .button.danger {
  background: #fff;
}

.save-status {
  min-height: 0;
  margin: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 720;
}

.save-status:not(:empty) {
  min-height: 20px;
  margin: 4px auto 8px;
  width: min(430px, 100%);
}

.template-menu {
  width: min(430px, 100%);
  margin: 0 auto 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(17, 24, 39, 0.08);
}

.template-menu[hidden] {
  display: none;
}

.template-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.template-menu-head strong {
  color: var(--ink);
  font-size: 13px;
}

.template-menu-head button {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
}

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

.template-options button {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-areas:
    "swatch title"
    "swatch text";
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.template-options button:hover,
.template-options button.active {
  border-color: #9ec5ff;
  background: #f8fbff;
}

.template-options button.active {
  box-shadow: inset 0 0 0 1px #1268d6;
}

.template-options strong {
  grid-area: title;
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
}

.template-options small {
  grid-area: text;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.template-swatch {
  grid-area: swatch;
  width: 44px;
  height: 34px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.template-swatch::before {
  content: "";
  position: absolute;
  inset: 7px 8px auto;
  height: 4px;
  border-radius: 999px;
  background: #111827;
}

.template-swatch::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 6px;
  border-radius: 2px;
  background: #eef2f7;
}

.template-swatch.style-blue::before {
  background: #1268d6;
}

.template-swatch.style-blue::after {
  background: #eaf3ff;
}

.template-swatch.style-minimal::before {
  background: #667085;
}

.template-swatch.style-minimal::after {
  background: #f2f4f7;
}

.template-swatch.style-emerald::before {
  background: #0f8f68;
}

.template-swatch.style-emerald::after {
  background: #ecfdf5;
}

.template-swatch.style-warm {
  background: #fffdf8;
}

.template-swatch.style-warm::before {
  background: #b7791f;
}

.template-swatch.style-warm::after {
  background: #fff4e6;
}

.template-swatch.style-modern::before {
  inset: 0 auto 0 0;
  width: 6px;
  height: auto;
  border-radius: 0;
  background: #5b5ce2;
}

.template-swatch.style-modern::after {
  background: #eef0ff;
}

.document-preview {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-width: 100%;
  overflow-x: hidden;
}

.doc-scale-frame {
  --doc-preview-scale: 0.653;
  width: calc(620px * var(--doc-preview-scale));
  max-width: 100%;
  margin: 0 auto;
  overflow: visible;
}

.doc-paper {
  --doc-accent: #1268d6;
  --doc-accent-ink: #1d3153;
  --doc-title: #3f444a;
  --doc-muted: #66748f;
  --doc-soft: #f3f5f8;
  --doc-border: #d8dee8;
  --doc-logo-border: #9ec5ff;
  --doc-logo-bg: #f8fbff;
  --doc-paper-bg: #fff;
  position: relative;
  width: 620px;
  min-height: 876px;
  margin: 0;
  padding: 44px;
  border: 1px solid var(--doc-border);
  border-radius: 4px;
  background: var(--doc-paper-bg);
  color: var(--doc-accent-ink);
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.1);
  transform: scale(0.653);
  transform-origin: top left;
  overflow: visible;
  overflow-wrap: anywhere;
  isolation: isolate;
}

.doc-paper::before {
  content: "";
  position: absolute;
  top: 26px;
  left: 44px;
  right: 44px;
  height: 4px;
  border-radius: 999px;
  background: var(--doc-accent);
  opacity: 0.9;
  z-index: 0;
}

.doc-paper > * {
  position: relative;
  z-index: 1;
}

.doc-style-classic::before {
  opacity: 0;
}

.doc-style-blue {
  --doc-accent: #1268d6;
  --doc-accent-ink: #123a70;
  --doc-title: #123a70;
  --doc-muted: #587096;
  --doc-soft: #eef6ff;
  --doc-border: #c9dff8;
  --doc-logo-border: #8bbdff;
  --doc-logo-bg: #f7fbff;
}

.doc-style-minimal {
  --doc-accent: #667085;
  --doc-accent-ink: #1f2937;
  --doc-title: #111827;
  --doc-muted: #667085;
  --doc-soft: #f2f4f7;
  --doc-border: #d0d5dd;
  --doc-logo-border: #b8c1cf;
  --doc-logo-bg: #f9fafb;
}

.doc-style-emerald {
  --doc-accent: #0f8f68;
  --doc-accent-ink: #064e3b;
  --doc-title: #0b3f31;
  --doc-muted: #52756b;
  --doc-soft: #ecfdf5;
  --doc-border: #b7dfd0;
  --doc-logo-border: #78cbb3;
  --doc-logo-bg: #f3fffa;
}

.doc-style-warm {
  --doc-accent: #b7791f;
  --doc-accent-ink: #6f3a11;
  --doc-title: #4f3422;
  --doc-muted: #806a5a;
  --doc-soft: #fff4e6;
  --doc-border: #edd5b7;
  --doc-logo-border: #e2b66f;
  --doc-logo-bg: #fffaf2;
  --doc-paper-bg: #fffdf8;
}

.doc-style-modern {
  --doc-accent: #5b5ce2;
  --doc-accent-ink: #28285f;
  --doc-title: #202044;
  --doc-muted: #626588;
  --doc-soft: #eef0ff;
  --doc-border: #d3d7ff;
  --doc-logo-border: #9ea5ff;
  --doc-logo-bg: #f8f8ff;
}

.doc-style-modern::before {
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  width: 8px;
  height: auto;
  border-radius: 0;
}

.doc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 34px;
  padding-bottom: 42px;
  border-bottom: 0;
}

.doc-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 96px;
}

.doc-logo-slot {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--doc-logo-border);
  border-radius: 999px;
  background: var(--doc-logo-bg);
  color: var(--doc-accent);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
}

.doc-logo-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.doc-title-stack {
  display: grid;
  justify-items: start;
  gap: 4px;
  text-align: left;
}

.doc-kicker {
  margin: 0;
  color: var(--doc-accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.doc-top h2 {
  margin: 0;
  max-width: 270px;
  color: var(--doc-title);
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.doc-title-stack p {
  margin: 0;
  color: var(--doc-muted);
  font-size: 13px;
  line-height: 1.35;
}

.doc-addresses span,
.doc-meta-grid span,
.doc-notes span,
.doc-totals span {
  color: var(--doc-accent-ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.doc-addresses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 76px;
  align-items: start;
  margin-top: 8px;
}

.doc-addresses section {
  display: grid;
  gap: 7px;
  align-content: start;
  align-items: start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.doc-addresses strong {
  color: var(--doc-muted);
  font-size: 14px;
  font-weight: 500;
}

.doc-addresses p,
.doc-notes p {
  margin: 0;
  color: var(--doc-muted);
  line-height: 1.55;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 54px;
  margin-top: 48px;
}

.doc-meta-grid div {
  display: grid;
  gap: 13px;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.doc-meta-grid strong {
  color: var(--doc-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.doc-table {
  width: 100%;
  margin-top: 58px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}

.doc-table th:first-child,
.doc-table td:first-child {
  width: 56%;
}

.doc-table th {
  padding: 11px 10px;
  border-bottom: 0;
  background: var(--doc-soft);
  color: var(--doc-accent-ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.doc-table th:first-child {
  border-radius: 3px 0 0 3px;
}

.doc-table th:last-child {
  border-radius: 0 3px 3px 0;
}

.doc-table th:first-child,
.doc-table td:first-child {
  text-align: left;
}

.doc-table td {
  padding: 15px 10px;
  border-bottom: 0;
  color: var(--doc-muted);
  text-align: right;
  vertical-align: top;
}

.doc-bottom {
  display: flex;
  justify-content: flex-end;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--doc-border);
}

.doc-notes {
  width: 58%;
  display: grid;
  gap: 26px;
  margin-top: 66px;
}

.doc-notes section {
  display: grid;
  gap: 7px;
}

.doc-totals {
  width: 240px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.doc-totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--doc-muted);
  font-size: 13px;
}

.doc-totals .grand-total {
  margin-top: 10px;
  padding-top: 17px;
  border-top: 1px solid var(--doc-border);
}

.doc-totals .grand-total strong {
  color: var(--doc-accent-ink);
  font-size: 26px;
}

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

.faq-list details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.faq-list summary {
  cursor: pointer;
  padding: 16px;
  font-weight: 760;
}

.faq-list p {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--muted);
}

.article-body {
  max-width: 860px;
  padding: 30px;
}

.article-body h2 {
  margin: 24px 0 8px;
  font-size: 24px;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 28px;
  padding: 30px 0 34px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.footer-about {
  display: grid;
  gap: 12px;
  align-content: start;
}

.site-footer p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.site-footer .footer-copyright {
  margin-top: 4px;
  font-size: 13px;
}

.footer-nav {
  display: grid;
  grid-template-columns: minmax(176px, 1.25fr) minmax(130px, 0.9fr) minmax(130px, 0.9fr) minmax(120px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.footer-group {
  display: grid;
  gap: 9px;
  align-content: start;
}

.footer-group h2 {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.footer-group a {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

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

.site-switcher {
  position: fixed;
  top: 82px;
  left: max(18px, calc((100vw - 1180px) / 2 - 92px), env(safe-area-inset-left));
  right: auto;
  z-index: 68;
  display: grid;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(203, 211, 223, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 46px rgba(26, 36, 58, 0.12);
  backdrop-filter: saturate(180%) blur(18px);
}

.site-switcher-link {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  background: var(--panel-soft);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.site-switcher-link img {
  display: block;
  width: 25px;
  height: 25px;
  border-radius: 8px;
}

.site-switcher-link::after {
  content: attr(data-site-name);
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  min-width: max-content;
  max-width: 220px;
  border: 1px solid rgba(203, 211, 223, 0.82);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 18px 46px rgba(26, 36, 58, 0.12);
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-4px, -50%);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.site-switcher-link:hover,
.site-switcher-link:focus-visible {
  border-color: rgba(18, 104, 214, 0.36);
  background: var(--panel);
  box-shadow: 0 0 0 4px rgba(18, 104, 214, 0.08);
  transform: translateY(-1px);
}

.site-switcher-link:hover::after,
.site-switcher-link:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.site-switcher-link:focus-visible,
.scroll-top-button:focus-visible {
  outline: 3px solid rgba(18, 104, 214, 0.24);
  outline-offset: 3px;
}

.scroll-top-button {
  position: fixed;
  right: max(18px, calc((100vw - 1180px) / 2 - 62px), env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 70;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(203, 211, 223, 0.82);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 46px rgba(26, 36, 58, 0.14);
  backdrop-filter: saturate(180%) blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.scroll-top-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.scroll-top-button:hover {
  border-color: rgba(18, 104, 214, 0.32);
  color: var(--brand);
  background: #fff;
  transform: translateY(-2px) scale(1);
}

.scroll-top-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="dark"] .hero-copy,
:root[data-theme="dark"] .hero-advantage-card,
:root[data-theme="dark"] .hero-panel,
:root[data-theme="dark"] .section-block,
:root[data-theme="dark"] .preview-panel,
:root[data-theme="dark"] .article-body,
:root[data-theme="dark"] .article-hero,
:root[data-theme="dark"] .tool-card,
:root[data-theme="dark"] .feature-card,
:root[data-theme="dark"] .guide-card,
:root[data-theme="dark"] .category-card,
:root[data-theme="dark"] .knowledge-card,
:root[data-theme="dark"] .faq-list details {
  background: rgba(17, 24, 39, 0.9);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .hero-advantage-card span {
  border-color: var(--line);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
}

:root[data-theme="dark"] .button,
:root[data-theme="dark"] .button.secondary,
:root[data-theme="dark"] .button.danger,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .action-help-card,
:root[data-theme="dark"] .preview-actions,
:root[data-theme="dark"] .template-menu,
:root[data-theme="dark"] .template-options button {
  background: rgba(15, 23, 42, 0.92);
  border-color: var(--line);
  color: var(--text);
}

:root[data-theme="dark"] .button.primary,
:root[data-theme="dark"] .preview-actions .button.primary {
  border-color: var(--brand);
  background: var(--brand-dark);
  color: #fff;
}

:root[data-theme="dark"] .button.ghost {
  background: transparent;
}

:root[data-theme="dark"] .button.danger,
:root[data-theme="dark"] .icon-button {
  color: var(--danger);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #0f172a;
  border-color: var(--line-strong);
  color: var(--text);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #74839a;
}

:root[data-theme="dark"] .editor-paper {
  background: #fff;
  color: #1d3153;
  border-color: #cbd3df;
}

:root[data-theme="dark"] .editor-paper input,
:root[data-theme="dark"] .editor-paper select,
:root[data-theme="dark"] .editor-paper textarea {
  background: #fff;
  border-color: #d5deeb;
  color: #172033;
}

:root[data-theme="dark"] .editor-title-input {
  color: #3f444a !important;
}

:root[data-theme="dark"] .editor-paper label,
:root[data-theme="dark"] .editor-logo-block .logo-help,
:root[data-theme="dark"] .editor-logo-block small,
:root[data-theme="dark"] .editor-tax-amount > span:first-child,
:root[data-theme="dark"] .editor-tax-amount strong,
:root[data-theme="dark"] .suffix-input span {
  color: #66748f;
}

:root[data-theme="dark"] .editor-paper label > span,
:root[data-theme="dark"] .editor-table-head span,
:root[data-theme="dark"] .line-amount,
:root[data-theme="dark"] .editor-total-line > span:first-child,
:root[data-theme="dark"] .editor-total-line strong {
  color: #1d3153;
}

:root[data-theme="dark"] .editor-table-head {
  background: #f3f5f8;
}

:root[data-theme="dark"] .editor-table-head [data-editable-label] {
  background: rgba(255, 255, 255, 0.68);
  border-color: #cbd5e1;
}

:root[data-theme="dark"] .guide-visual {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.96));
}

:root[data-theme="dark"] .guide-visual-flow span,
:root[data-theme="dark"] .guide-visual-compare div {
  border-color: var(--line);
  background: rgba(11, 16, 24, 0.82);
  color: var(--text);
}

:root[data-theme="dark"] .visual-doc-head {
  color: var(--text);
}

:root[data-theme="dark"] .visual-doc-row,
:root[data-theme="dark"] .visual-doc-total {
  background: #334155;
}

:root[data-theme="dark"] .visual-doc-total {
  background: var(--brand);
}

:root[data-theme="dark"] .template-options button:hover,
:root[data-theme="dark"] .template-options button.active {
  border-color: rgba(100, 168, 255, 0.65);
  background: rgba(18, 104, 214, 0.16);
}

:root[data-theme="dark"] .template-options button.active {
  box-shadow: inset 0 0 0 1px var(--brand);
}

:root[data-theme="dark"] .template-menu-head button {
  color: var(--brand);
}

:root[data-theme="dark"] .site-footer {
  border-top-color: var(--line);
}

:root[data-theme="dark"] .site-switcher,
:root[data-theme="dark"] .scroll-top-button {
  border-color: var(--line);
  background: rgba(17, 24, 39, 0.9);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .site-switcher-link {
  background: rgba(15, 23, 42, 0.92);
}

:root[data-theme="dark"] .site-switcher-link:hover,
:root[data-theme="dark"] .site-switcher-link:focus-visible {
  border-color: rgba(100, 168, 255, 0.35);
  background: rgba(100, 168, 255, 0.1);
}

:root[data-theme="dark"] .site-switcher-link::after {
  border-color: var(--line);
  background: rgba(17, 24, 39, 0.98);
  color: var(--text);
}

:root[data-theme="dark"] .scroll-top-button:hover {
  background: rgba(17, 24, 39, 0.98);
}

@media (max-width: 1180px) {
  .tool-layout {
    width: 100%;
    margin-left: 0;
    transform: none;
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

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

  .tool-grid,
  .feature-grid,
  .category-grid,
  .knowledge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  main,
  .site-nav,
  .site-footer {
    width: min(100% - 28px, 1180px);
  }

  .site-footer {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .site-footer p {
    max-width: 560px;
  }

  .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 34px;
  }

  .site-nav {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .nav-right {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .nav-links {
    width: 100%;
    padding-bottom: 3px;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .site-switcher {
    top: 70px;
    left: max(12px, env(safe-area-inset-left));
    right: auto;
    gap: 6px;
    padding: 5px;
  }

  .site-switcher-link {
    width: 40px;
    height: 40px;
  }

  .site-switcher-link::after {
    left: calc(100% + 8px);
    max-width: min(210px, calc(100vw - 78px));
  }

  .scroll-top-button {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
  }

  .hero-copy,
  .hero-panel,
  .section-block,
  .preview-panel,
  .article-body {
    padding: 20px;
  }

  .document-form {
    padding: 0;
  }

  .editor-paper {
    padding: 20px;
    gap: 28px;
  }

  .editor-top,
  .editor-parties,
  .editor-summary-row {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    display: grid;
    gap: 12px;
    align-content: start;
  }

  .editor-panel > * {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  .editor-logo-block {
    justify-self: start;
  }

  .editor-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-copy h1,
  .page-hero h1 {
    font-size: 40px;
  }

  .hero-copy p,
  .page-hero p {
    font-size: 16px;
  }

  .field-grid,
  .tool-grid,
  .feature-grid,
  .guide-grid,
  .category-grid,
  .knowledge-grid,
  .article-hero,
  .doc-addresses,
  .doc-bottom {
    grid-template-columns: 1fr;
  }

  .article-hero {
    padding: 20px;
  }

  .article-cta {
    display: grid;
    align-items: start;
  }

  .guide-visual-flow {
    grid-template-columns: 1fr;
  }

  .guide-visual-flow i {
    width: 2px;
    height: 14px;
    justify-self: center;
  }

  .line-item-row {
    grid-template-columns: 1fr;
    padding: 46px 14px 14px;
  }

  .editor-table-head {
    display: none;
  }

  .editor-items .line-item-row {
    grid-template-columns: 1fr;
    padding: 14px;
    border: 1px solid var(--line);
    background: #fff;
  }

  .editor-items .line-item-row label > span {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
  }

  .line-number {
    top: 14px;
  }

  .line-item-row .icon-button {
    width: 100%;
  }

  .line-amount {
    justify-content: flex-start;
    padding: 0;
  }

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

  .template-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .doc-paper {
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: auto;
    margin-left: 0;
    margin-bottom: 0;
    padding: 24px;
    transform: none;
    overflow: visible;
  }

  .doc-scale-frame {
    --doc-preview-scale: 1;
    width: 100%;
    height: auto !important;
  }

  .doc-top,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .doc-top {
    display: grid;
  }

  .doc-logo-wrap {
    min-width: 0;
    justify-content: flex-start;
  }

  .doc-title-stack {
    justify-items: start;
    text-align: left;
  }

  .doc-title-stack h2 {
    max-width: none;
    text-align: left;
  }

  .doc-number {
    justify-items: start;
  }

  .doc-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-bottom {
    display: block;
  }

  .doc-totals,
  .doc-notes {
    width: 100%;
  }
}

@media (max-width: 520px) {
  main {
    padding-top: 26px;
  }

  .footer-nav {
    grid-template-columns: 1fr;
  }

  .brand-text {
    font-size: 14px;
  }

  .hero-copy h1,
  .page-hero h1 {
    font-size: 34px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .preview-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .template-options {
    grid-template-columns: 1fr;
  }

  .doc-meta-grid {
    grid-template-columns: 1fr;
  }

  .editor-number-row,
  .editor-inline-grid,
  .editor-meta-grid {
    grid-template-columns: 1fr;
  }

  .editor-title-input {
    font-size: 30px !important;
  }

  .doc-table {
    font-size: 11px;
  }

  .doc-table th {
    font-size: 9px;
    white-space: normal;
  }

  .doc-table th,
  .doc-table td {
    padding: 8px 4px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 6mm;
  }

  html,
  body {
    background: #fff;
    color: #000;
    width: auto;
    margin: 0;
  }

  .site-header,
  .site-footer,
  .nav-links,
  .page-hero,
  .hero,
  .document-form,
  .action-help-card,
  .preview-actions,
  .template-menu,
  .save-status,
  .site-switcher,
  .scroll-top-button,
  .related-tools,
  .faq-section,
  button,
  .button {
    display: none !important;
  }

  main {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .tool-layout,
  .preview-panel,
  .document-preview,
  .doc-scale-frame {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
    height: auto !important;
  }

  .document-preview {
    overflow: visible;
  }

  .doc-scale-frame {
    --doc-preview-scale: 1;
    --doc-print-scale: 1.16;
    width: calc(620px * var(--doc-print-scale));
    max-width: 100%;
    margin: 0 auto;
  }

  .doc-paper {
    width: 620px;
    max-width: 620px;
    min-width: 620px;
    min-height: 0;
    height: auto;
    margin: 0 auto;
    padding: 34px;
    border: 1px solid var(--doc-border);
    border-radius: 0;
    box-shadow: none;
    transform: none;
    zoom: var(--doc-print-scale);
    overflow: visible;
    color: #000;
    background: var(--doc-paper-bg);
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .doc-paper::before {
    display: block;
    top: 20px;
    left: 34px;
    right: 34px;
  }

  .doc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    padding-bottom: 24px;
  }

  .doc-logo-wrap {
    min-width: 76px;
    justify-content: flex-end;
  }

  .doc-logo-slot {
    width: 76px;
    height: 76px;
    font-size: 10px;
  }

  .doc-title-stack {
    justify-items: start;
    text-align: left;
  }

  .doc-top h2 {
    max-width: 270px;
    font-size: 30px;
    text-align: left;
  }

  .doc-title-stack p {
    font-size: 11px;
  }

  .doc-addresses span,
  .doc-meta-grid span,
  .doc-notes span,
  .doc-totals span {
    font-size: 10.5px;
  }

  .doc-addresses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 56px;
    margin-top: 4px;
  }

  .doc-addresses section,
  .doc-meta-grid div,
  .doc-notes section {
    background: transparent;
  }

  .doc-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 42px;
    margin-top: 30px;
  }

  .doc-meta-grid div {
    gap: 8px;
  }

  .doc-addresses strong,
  .doc-meta-grid strong {
    font-size: 12px;
  }

  .doc-addresses p,
  .doc-notes p,
  .doc-table td {
    font-size: 12px;
    line-height: 1.35;
  }

  .doc-table {
    margin-top: 34px;
    font-size: 11px;
  }

  .doc-table th {
    padding: 8px 9px;
    font-size: 10.5px;
  }

  .doc-table td {
    padding: 10px 9px;
  }

  .doc-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 34px;
    padding-top: 18px;
  }

  .doc-totals {
    width: 240px;
    gap: 8px;
  }

  .doc-totals .grand-total {
    margin-top: 6px;
    padding-top: 12px;
  }

  .doc-totals .grand-total strong {
    font-size: 22px;
  }

  .doc-notes {
    width: 55%;
    gap: 16px;
    margin-top: 34px;
  }

  .doc-table tr,
  .doc-addresses section,
  .doc-meta-grid div,
  .doc-notes section,
  .doc-totals {
    break-inside: avoid;
  }
}
