/**
 * Zuanxin × Flowbite — brand tokens & utilities
 * Primary palette based on #3B5998 (HostGator bundle, no build step)
 */

:root {
  --color-primary-50: #eef2f9;
  --color-primary-100: #d9e2f0;
  --color-primary-200: #b3c5e1;
  --color-primary-300: #8da8d2;
  --color-primary-400: #678bc3;
  --color-primary-500: #4a6eaf;
  --color-primary-600: #3b5998;
  --color-primary-700: #2f4779;
  --color-primary-800: #23355a;
  --color-primary-900: #17233b;
}

.bg-primary-50 { background-color: var(--color-primary-50); }
.bg-primary-100 { background-color: var(--color-primary-100); }

/* Language switcher — active locale pill */
.zx-lang-switch-active {
  background-color: var(--color-primary-100);
  color: var(--color-primary-800);
  font-weight: 500;
}

.dark .zx-lang-switch-active {
  background-color: var(--color-primary-700);
  color: #f9fafb;
}

.dark .zx-lang-switch-active:hover {
  color: #fff;
}
.bg-primary-400 { background-color: var(--color-primary-400); }
.bg-primary-500 { background-color: var(--color-primary-500); }
.bg-primary-600 { background-color: var(--color-primary-600); }
.bg-primary-700 { background-color: var(--color-primary-700); }
.bg-primary-800 { background-color: var(--color-primary-800); }
.bg-primary-900 { background-color: var(--color-primary-900); }
.hover\:bg-primary-400:hover { background-color: var(--color-primary-400); }
.hover\:bg-primary-500:hover { background-color: var(--color-primary-500); }
.hover\:bg-primary-600:hover { background-color: var(--color-primary-600); }
.hover\:bg-primary-800:hover { background-color: var(--color-primary-800); }
.hover\:bg-primary-900:hover { background-color: var(--color-primary-900); }
.hover\:bg-primary-700:hover { background-color: var(--color-primary-700); }
.dark .dark\:bg-primary-600 { background-color: var(--color-primary-600); }
.dark .dark\:hover\:bg-primary-700:hover { background-color: var(--color-primary-700); }

.text-primary-600 { color: var(--color-primary-600); }
.text-primary-700 { color: var(--color-primary-700); }
.text-primary-500 { color: var(--color-primary-500); }
.hover\:text-primary-600:hover { color: var(--color-primary-600); }
.dark .dark\:text-primary-500 { color: var(--color-primary-400); }
.dark .dark\:text-primary-400 { color: var(--color-primary-200); }
.dark .dark\:text-primary-300 { color: var(--color-primary-100); }

.border-primary-500 { border-color: var(--color-primary-500); }
.focus\:ring-primary-300:focus { --tw-ring-color: var(--color-primary-200); }
.focus\:border-primary-500:focus { border-color: var(--color-primary-500); }
.focus\:ring-primary-500:focus { --tw-ring-color: var(--color-primary-500); }
.dark .dark\:focus\:ring-primary-500:focus { --tw-ring-color: var(--color-primary-500); }
.dark .dark\:focus\:border-primary-500:focus { border-color: var(--color-primary-500); }
.focus\:ring-primary-800:focus { --tw-ring-color: var(--color-primary-800); }
.dark .dark\:focus\:ring-primary-800:focus { --tw-ring-color: var(--color-primary-700); }

.ring-primary-300 { --tw-ring-color: var(--color-primary-200); }
.dark .dark\:ring-primary-600 { --tw-ring-color: var(--color-primary-600); }
.dark .dark\:focus\:ring-primary-600:focus { --tw-ring-color: var(--color-primary-600); }

/* Data table header cells */
.zx-table-th {
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  text-align: left;
  color: #6b7280;
  text-transform: uppercase;
}
.dark .zx-table-th {
  color: #d1d5db;
}

/* Status badges — explicit light/dark contrast */
.zx-status-badge {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1.25rem;
  font-weight: 500;
  padding: 0.125rem 0.625rem;
  border-radius: 0.25rem;
}
.zx-status-badge--green {
  background-color: #dcfce7;
  color: #166534;
}
.dark .zx-status-badge--green {
  background-color: #14532d;
  color: #bbf7d0;
}
.zx-status-badge--yellow {
  background-color: #fef9c3;
  color: #854d0e;
}
.dark .zx-status-badge--yellow {
  background-color: #713f12;
  color: #fef08a;
}
.zx-status-badge--orange {
  background-color: #ffedd5;
  color: #9a3412;
}
.dark .zx-status-badge--orange {
  background-color: #7c2d12;
  color: #fed7aa;
}

/* Report KPI: amber utilities are purged from Flowbite build — use explicit tokens */
.zx-kpi-payable {
  background-color: #fffbeb;
}
.dark .zx-kpi-payable {
  background-color: #374151; /* gray-700 — reliable dark surface */
}
.zx-kpi-payable-value {
  color: #b45309; /* amber-700 */
}
.dark .zx-kpi-payable-value {
  color: #fcd34d; /* amber-300 — high contrast on gray-700 */
}

.zx-status-badge--blue {
  background-color: #dbeafe;
  color: #1e40af;
}
.dark .zx-status-badge--blue {
  background-color: #1e3a8a;
  color: #bfdbfe;
}
.zx-status-badge--red {
  background-color: #fee2e2;
  color: #991b1b;
}
.dark .zx-status-badge--red {
  background-color: #7f1d1d;
  color: #fecaca;
}
.zx-status-badge--purple {
  background-color: #f3e8ff;
  color: #6b21a8;
}
.dark .zx-status-badge--purple {
  background-color: #581c87;
  color: #e9d5ff;
}
.zx-status-badge--gray {
  background-color: #f3f4f6;
  color: #374151;
}
.dark .zx-status-badge--gray {
  background-color: #374151;
  color: #e5e7eb;
}

/* Rich text blocks (contracts, templates) — typography plugin not bundled */
.zx-prose {
  max-width: none;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  color: #1f2937;
  line-height: 1.625;
}
.dark .zx-prose {
  border-color: #4b5563;
  background-color: #374151;
  color: #f3f4f6;
}
.dark .zx-prose :where(p, li, span, div, td, th, h1, h2, h3, h4, h5, h6, strong, em):not([data-zx-cell-bg]) {
  color: inherit !important;
}
/* Word cell shading: keep ambient text; fill is softened via --zx-cell-bg below. */
.dark .zx-prose :where(td, th)[data-zx-cell-bg] :where(p, li, span, div, strong, em) {
  color: inherit !important;
}

/*
 * Soften Word cell fills for on-screen reading (match list-row hover brightness).
 * Original hex stays on data-zx-cell-bg / --zx-cell-bg for print/PDF.
 * Light hover reference: #f1f5f9 · Dark hover reference: #334155
 */
.zx-prose :where(td, th)[data-zx-cell-bg],
.zx-ckeditor-preview-doc :where(td, th)[data-zx-cell-bg],
.zx-sign-document :where(td, th)[data-zx-cell-bg] {
  background-color: color-mix(in srgb, var(--zx-cell-bg, #f2f2f2) 28%, #f1f5f9) !important;
}

.dark .zx-prose :where(td, th)[data-zx-cell-bg],
.dark .zx-ckeditor-preview-doc :where(td, th)[data-zx-cell-bg],
.dark .zx-sign-document :where(td, th)[data-zx-cell-bg] {
  background-color: color-mix(in srgb, var(--zx-cell-bg, #f2f2f2) 10%, #334155) !important;
  color: inherit !important;
}
.dark .zx-prose a {
  color: #93c5fd !important;
}

/* CKEditor 4 trial — dark chrome (moono-lisa icons/labels are dark; invert for contrast) */
.zx-ckeditor-field .cke_chrome.zx-ck4-dark {
  border-color: #4b5563 !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_top,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_bottom {
  background: #374151 !important;
  border-color: #4b5563 !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_toolgroup,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_button {
  background: #4b5563 !important;
  border-color: #6b7280 !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_button_icon {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_button_disabled .cke_button_icon {
  opacity: 0.35;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_button_label,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_text,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_inlinelabel {
  color: #e5e7eb !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_arrow,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_button_arrow {
  border-top-color: #d1d5db !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark a.cke_button:hover,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark a.cke_button:focus,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark a.cke_button:active,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_button:hover,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_button:focus,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_button:active {
  background: #6b7280 !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark a.cke_button_on,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_combo_button_on {
  background: #1f2937 !important;
}
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_wysiwyg_frame,
.zx-ckeditor-field .cke_chrome.zx-ck4-dark .cke_wysiwyg_div {
  background: #374151 !important;
}

/* Contract / template rich text — Word-like typography (editor + preview) */
.zx-ckeditor-field .ck-content,
.zx-ckeditor-field .cke_editable,
.zx-prose {
  font-family: "Microsoft JhengHei", "微軟正黑體", sans-serif;
  font-size: 11pt;
  line-height: 1.5;
}
.zx-ckeditor-field .ck-content h1,
.zx-prose h1 {
  text-align: center;
  font-size: 24pt;
  font-weight: 700;
  margin-top: 12pt;
  margin-bottom: 15pt;
}
.zx-ckeditor-field .ck-content h2,
.zx-prose h2 {
  font-size: 16pt;
  font-weight: 700;
  margin-top: 18.75pt;
  margin-bottom: 15pt;
}
.zx-ckeditor-field .ck-content h3,
.zx-prose h3 {
  font-size: 14pt;
  font-weight: 700;
  margin-top: 15pt;
  margin-bottom: 12pt;
}
.zx-ckeditor-field .ck-content table,
.zx-prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75rem 0;
}
.zx-ckeditor-field .ck-content table[align="center"],
.zx-prose table[align="center"],
.zx-ckeditor-preview-doc table[align="center"],
.zx-sign-document table[align="center"] {
  width: auto !important;
  max-width: 100%;
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
}
.zx-ckeditor-field .ck-content table[align="left"],
.zx-prose table[align="left"],
.zx-ckeditor-preview-doc table[align="left"],
.zx-sign-document table[align="left"] {
  width: auto !important;
  max-width: 100%;
  margin-right: auto !important;
  margin-left: 0 !important;
  float: none !important;
}
.zx-ckeditor-field .ck-content table[align="right"],
.zx-prose table[align="right"],
.zx-ckeditor-preview-doc table[align="right"],
.zx-sign-document table[align="right"] {
  width: auto !important;
  max-width: 100%;
  margin-left: auto !important;
  margin-right: 0 !important;
  float: none !important;
}
.zx-ckeditor-field .ck-content table td,
.zx-ckeditor-field .ck-content table th,
.zx-prose table td,
.zx-prose table th,
.zx-ckeditor-preview-doc td,
.zx-ckeditor-preview-doc th,
.zx-sign-document td,
.zx-sign-document th {
  border: 1px solid #000;
  padding: 4px 8px;
  vertical-align: top;
}

/* Cell alignment must win over the default vertical-align:top above. */
.zx-ckeditor-preview-doc td[style*="text-align:center"],
.zx-ckeditor-preview-doc td[style*="text-align: center"],
.zx-ckeditor-preview-doc th[style*="text-align:center"],
.zx-ckeditor-preview-doc th[style*="text-align: center"],
.zx-ckeditor-preview-doc td[align="center"],
.zx-ckeditor-preview-doc th[align="center"],
.zx-sign-document td[style*="text-align:center"],
.zx-sign-document td[style*="text-align: center"],
.zx-sign-document th[style*="text-align:center"],
.zx-sign-document th[style*="text-align: center"],
.zx-sign-document td[align="center"],
.zx-sign-document th[align="center"],
.zx-prose td[style*="text-align:center"],
.zx-prose td[style*="text-align: center"],
.zx-prose th[style*="text-align:center"],
.zx-prose th[style*="text-align: center"],
.zx-prose td[align="center"],
.zx-prose th[align="center"] {
  text-align: center !important;
}

.zx-ckeditor-preview-doc td[style*="vertical-align:middle"],
.zx-ckeditor-preview-doc td[style*="vertical-align: middle"],
.zx-ckeditor-preview-doc th[style*="vertical-align:middle"],
.zx-ckeditor-preview-doc th[style*="vertical-align: middle"],
.zx-ckeditor-preview-doc td[valign="middle"],
.zx-ckeditor-preview-doc th[valign="middle"],
.zx-sign-document td[style*="vertical-align:middle"],
.zx-sign-document td[style*="vertical-align: middle"],
.zx-sign-document th[style*="vertical-align:middle"],
.zx-sign-document th[style*="vertical-align: middle"],
.zx-sign-document td[valign="middle"],
.zx-sign-document th[valign="middle"],
.zx-prose td[style*="vertical-align:middle"],
.zx-prose td[style*="vertical-align: middle"],
.zx-prose th[style*="vertical-align:middle"],
.zx-prose th[style*="vertical-align: middle"],
.zx-prose td[valign="middle"],
.zx-prose th[valign="middle"] {
  vertical-align: middle !important;
}

.zx-ckeditor-preview-doc td[style*="vertical-align:bottom"],
.zx-ckeditor-preview-doc td[style*="vertical-align: bottom"],
.zx-ckeditor-preview-doc th[style*="vertical-align:bottom"],
.zx-ckeditor-preview-doc th[style*="vertical-align: bottom"],
.zx-ckeditor-preview-doc td[valign="bottom"],
.zx-ckeditor-preview-doc th[valign="bottom"],
.zx-sign-document td[style*="vertical-align:bottom"],
.zx-sign-document td[style*="vertical-align: bottom"],
.zx-sign-document td[valign="bottom"],
.zx-prose td[style*="vertical-align:bottom"],
.zx-prose td[style*="vertical-align: bottom"],
.zx-prose td[valign="bottom"] {
  vertical-align: bottom !important;
}

/*
 * Preview restores body paragraph spacing with margin-bottom:1em.
 * Inside table cells that asymmetric margin makes vertically-centered
 * text look top-biased — match the editor (balanced / zero cell margins).
 */
.zx-ckeditor-preview-doc table td > p,
.zx-ckeditor-preview-doc table th > p,
.zx-ckeditor-preview-doc table td > div,
.zx-ckeditor-preview-doc table th > div,
.zx-prose table td > p,
.zx-prose table th > p,
.zx-prose table td > div,
.zx-prose table th > div,
.zx-sign-document table td > p,
.zx-sign-document table th > p,
.zx-sign-document table td > div,
.zx-sign-document table th > div {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.zx-ckeditor-preview-doc td[align="left"],
.zx-ckeditor-preview-doc th[align="left"] {
  text-align: left !important;
}

.zx-ckeditor-preview-doc td[align="right"],
.zx-ckeditor-preview-doc th[align="right"] {
  text-align: right !important;
}

/* Override Tailwind preflight (list-style:none) inside contract editor/preview */
.zx-ckeditor-field .ck-content ul,
.zx-prose ul {
  list-style-type: disc;
  list-style-position: outside;
  margin: 0.5em 0;
  padding-left: 1.5em;
}
.zx-ckeditor-field .ck-content ol,
.zx-prose ol {
  list-style-type: decimal;
  list-style-position: outside;
  margin: 0.5em 0;
  padding-left: 1.5em;
}
.zx-ckeditor-field .ck-content ul ul,
.zx-prose ul ul {
  list-style-type: circle;
}
.zx-ckeditor-field .ck-content ul ul ul,
.zx-prose ul ul ul {
  list-style-type: square;
}
.zx-ckeditor-field .ck-content li,
.zx-prose li {
  display: list-item;
}
/* Inline Word borders (#000) must yield in dark UI so grid lines stay visible. */
.dark .zx-ckeditor-field .ck-content table td,
.dark .zx-ckeditor-field .ck-content table th,
.dark .zx-prose table td,
.dark .zx-prose table th,
.dark .zx-sign-document table td,
.dark .zx-sign-document table th,
.dark .zx-ckeditor-preview-doc table td,
.dark .zx-ckeditor-preview-doc table th {
  border-color: #d1d5db !important;
}

/* Form labels & detail field titles — dark mode contrast */
.zx-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #111827;
}
.dark .zx-field-label {
  color: #f3f4f6;
}

.zx-field-title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #4b5563;
}
.dark .zx-field-title {
  color: #e5e7eb;
}

.zx-section-title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #4b5563;
}
.dark .zx-section-title {
  color: #e5e7eb;
}

/* Fallback: labels/titles that still use Tailwind gray utilities */
.dark label.block.text-sm.font-medium,
.dark label.block.text-sm.mb-1,
.dark label.block.mb-1.text-sm,
.dark label.block.mb-2.text-sm.font-medium,
.dark label.block.text-sm.mb-2 {
  color: #f3f4f6;
}
.dark dt.text-gray-500,
.dark dt.text-sm.text-gray-500,
.dark dt.text-sm.text-gray-500.dark\:text-gray-400 {
  color: #e5e7eb;
}
.dark h2.text-sm.font-semibold.text-gray-500,
.dark h2.text-gray-500 {
  color: #e5e7eb;
}
.dark label.text-xs.text-gray-500 {
  color: #d1d5db;
}

/* Muted copy on dark surfaces (lists, hints, subtitles) */
.dark p.text-sm.text-gray-500,
.dark p.text-xs.text-gray-500,
.dark p.font-mono.text-sm.text-gray-500,
.dark span.text-sm.text-gray-500,
.dark li.text-sm.text-gray-500,
.dark legend.text-sm.font-semibold.text-gray-500 {
  color: #d1d5db;
}

.dark td.text-sm.text-gray-500,
.dark td.p-4.text-sm.text-gray-500,
.dark td.text-gray-500,
.dark td.p-3.text-gray-500,
.dark td.p-8.text-center.text-gray-500 {
  color: #d1d5db;
}

.dark p.text-gray-600,
.dark span.text-gray-600 {
  color: #d1d5db;
}

/* Data tables inside dark cards (entity-related tabs, etc.) */
.dark .dark\:bg-gray-800 table.min-w-full tbody td,
.dark .dark\:bg-gray-700 table.min-w-full tbody td {
  color: #e5e7eb;
}

.dark .dark\:bg-gray-800 table.min-w-full tbody td.font-mono,
.dark .dark\:bg-gray-700 table.min-w-full tbody td.font-mono {
  color: #d1d5db;
}

/* Data table headers: enforce contrast in light/dark themes */
table.min-w-full thead th {
  color: #6b7280;
  font-weight: 600;
}

.dark table.min-w-full thead th {
  color: #e5e7eb;
}

/* Standard list-table row hover (all index/list pages) */
table.min-w-full:not(.zx-no-row-hover) tbody tr {
  transition: background-color 0.12s ease;
}

table.min-w-full:not(.zx-no-row-hover) tbody tr:hover {
  background-color: #f1f5f9;
}

.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover {
  background-color: #334155;
}

.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover td {
  color: #f9fafb;
}

.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover td.text-gray-500,
.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover td.text-gray-400,
.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover td .text-gray-500,
.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover td .text-gray-400 {
  color: #d1d5db;
}

.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover .text-primary-600,
.dark table.min-w-full:not(.zx-no-row-hover) tbody tr:hover .text-primary-400 {
  color: #93c5fd;
}

/* Dark mode surface backgrounds (opacity-modifier dark: utilities are not in CSS bundle) */
.dark .bg-gray-50 {
  background-color: #374151;
}

.dark .bg-gray-100 {
  background-color: #374151;
}

.dark .bg-primary-50 {
  background-color: #17233b;
}

.dark .bg-amber-50,
.dark .bg-amber-50\/50 {
  background-color: #451a03;
}

.dark .bg-blue-50,
.dark .bg-blue-50\/40,
.dark .bg-blue-50\/50 {
  background-color: #1e3a5f;
}

.dark .bg-green-50 {
  background-color: #14532d;
}

.dark .bg-red-50 {
  background-color: #450a0a;
}

/* Muted inset panels (approval summaries, form sections) */
.zx-panel-muted {
  background-color: #f9fafb;
}

.dark .zx-panel-muted {
  background-color: #374151;
}

.dark .zx-panel-muted .text-gray-500,
.dark .zx-panel-muted .text-gray-400 {
  color: #9ca3af;
}

/* Field change diff (approval workbench + detail history) */
.zx-field-change-old {
  color: #4b5563;
}

.zx-field-change-arrow {
  color: #9ca3af;
}

.zx-field-change-new {
  color: #111827;
}

.dark .zx-panel-muted .zx-field-change-old,
.dark .zx-field-change-old {
  color: #d1d5db;
}

.dark .zx-panel-muted .zx-field-change-arrow,
.dark .zx-field-change-arrow {
  color: #9ca3af;
}

.dark .zx-panel-muted .zx-field-change-new,
.dark .zx-field-change-new {
  color: #f9fafb;
}

/* Read-only summary fields (approval workbench — matches edit form inputs) */
.zx-summary-field-value {
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.625rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.zx-summary-field-value--multiline,
.zx-summary-field-value.zx-summary-field-value--multiline {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  text-align: left;
}

.zx-summary-line-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.zx-summary-line-list li + li {
  margin-top: 0.375rem;
}

.dark .zx-summary-field-value {
  background-color: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .zx-panel-muted .zx-summary-field-value {
  background-color: #1f2937;
  border-color: #4b5563;
}

/* Detail pages visual consistency */
.zx-detail-fields {
  width: 100%;
  max-width: none;
}

.zx-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.zx-detail-section-title {
  margin-bottom: 0.75rem;
}

/* Flash banners stay under the fixed navbar so validation errors remain visible. */
[data-flash-stack] {
  position: sticky;
  top: var(--zx-navbar-height, 3.5rem);
  z-index: 45;
  background-color: #f9fafb;
}

.dark [data-flash-stack] {
  background-color: #111827;
}

[data-flash-stack]:empty {
  display: none;
}

/* Sticky action bar for detail and form pages (see form-page-header.php).
 * Must paint above scrolling page content so text cannot show through.
 * --zx-navbar-height is measured in layouts/app.php (fallback 3.5rem). */
.zx-sticky-action-header {
  position: sticky;
  top: calc(var(--zx-navbar-height, 3.5rem) + var(--zx-sticky-flash-offset, 0px));
  z-index: 40;
  isolation: isolate;
  background-color: #fff;
  /* Seal sub-pixel gap against the fixed navbar while stuck. */
  box-shadow: 0 -4px 0 #fff;
}

.dark .zx-sticky-action-header {
  background-color: #1f2937;
  box-shadow: 0 -4px 0 #1f2937;
}

/* Seal only the thin gap against the navbar. When flash banners are present,
 * --zx-sticky-flash-offset pushes this bar down; extending ::before by the full
 * navbar height would paint over the flash and hide validation messages. */
.zx-sticky-action-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: max(4px, calc(var(--zx-navbar-height, 3.5rem) + 4px - var(--zx-sticky-flash-offset, 0px)));
  background-color: inherit;
  pointer-events: none;
  z-index: -1;
}

/* Property rooms master-detail panel */
.zx-room-panel-grid {
  display: flex;
  flex-direction: column;
  max-height: min(70dvh, 640px);
  background-color: #fff;
}

.dark .zx-room-panel-grid {
  background-color: #1f2937;
}

@media (min-width: 1024px) {
  .zx-room-panel-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
  }
}

.zx-room-master {
  border-bottom: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.dark .zx-room-master {
  border-color: #4b5563;
  background-color: #111827;
}

.zx-room-master-scroll {
  max-height: min(70dvh, 600px);
  overflow-y: auto;
}

.zx-room-master-item--active {
  background-color: #eef2f9;
  border-left: 4px solid var(--color-primary-600, #1d4ed8);
  padding-left: calc(0.75rem - 4px);
}

.dark .zx-room-master-item--active {
  background-color: #1e3a5f;
  border-left-color: var(--color-primary-400, #60a5fa);
}

.zx-room-detail {
  min-height: 280px;
  max-height: min(70dvh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.zx-room-detail-scroll {
  overflow-y: auto;
  max-height: min(70dvh, 640px);
}

.zx-room-filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  color: #374151;
  background-color: #fff;
  cursor: pointer;
}

.zx-room-filter-chip:hover {
  background-color: #f3f4f6;
}

.zx-room-filter-chip--active {
  border-color: var(--color-primary-600, #1d4ed8);
  color: var(--color-primary-700, #1d4ed8);
  background-color: #eef2f9;
}

.dark .zx-room-filter-chip {
  border-color: #4b5563;
  color: #e5e7eb;
  background-color: #374151;
}

.dark .zx-room-filter-chip:hover {
  background-color: #4b5563;
}

.dark .zx-room-filter-chip--active {
  border-color: var(--color-primary-400, #60a5fa);
  color: #93c5fd;
  background-color: #1e3a5f;
}

.zx-room-mobile-chip {
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  color: #374151;
  background-color: #fff;
  white-space: nowrap;
}

.zx-room-mobile-chip--active {
  border-color: var(--color-primary-600, #1d4ed8);
  color: #fff;
  background-color: var(--color-primary-700, #1d4ed8);
}

.dark .zx-room-mobile-chip {
  border-color: #4b5563;
  color: #e5e7eb;
  background-color: #374151;
}

.dark .zx-room-mobile-chip--active {
  border-color: var(--color-primary-500, #3b82f6);
  background-color: var(--color-primary-600, #2563eb);
  color: #fff;
}

.zx-amenity-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.zx-amenity-chip--more {
  background-color: #eef2f9;
  color: var(--color-primary-700, #1d4ed8);
  border-color: #c7d2fe;
  cursor: pointer;
}

button.zx-amenity-chip {
  margin: 0;
  font-size: 0.75rem;
  font-weight: inherit;
  line-height: 1.25;
}

.dark .zx-amenity-chip {
  background-color: #374151;
  color: #e5e7eb;
  border-color: #4b5563;
}

.dark .zx-amenity-chip--more {
  background-color: #1e3a5f;
  color: #93c5fd;
  border-color: #1e40af;
}

.zx-unit-room-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.zx-unit-room-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.zx-unit-room-chip:has(input:checked) {
  background-color: #eef2f9;
  color: var(--color-primary-700, #1d4ed8);
  border-color: #c7d2fe;
}

.dark .zx-unit-room-chip {
  background-color: #374151;
  color: #e5e7eb;
  border-color: #4b5563;
}

.dark .zx-unit-room-chip:has(input:checked) {
  background-color: #1e3a5f;
  color: #93c5fd;
  border-color: #1e40af;
}

/* Document thumbnail grid */
.zx-doc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.375rem;
}

@media (min-width: 640px) {
  .zx-doc-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .zx-doc-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

.zx-doc-thumb {
  position: relative;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  overflow: hidden;
}

.dark .zx-doc-thumb {
  border-color: #4b5563;
  background-color: #374151;
}

.zx-doc-thumb--selected {
  box-shadow: 0 0 0 2px var(--color-primary-600, #2563eb);
  border-color: var(--color-primary-600, #2563eb);
}

.zx-doc-thumb__check-wrap {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  margin: -0.25rem 0 0 -0.25rem;
  padding: 0.25rem;
  cursor: pointer;
}

.zx-doc-thumb__check {
  width: 0.875rem;
  height: 0.875rem;
  cursor: pointer;
}

.zx-doc-thumb__body {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  text-decoration: none;
}

.zx-doc-thumb__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background-color: #e5e7eb;
}

.dark .zx-doc-thumb__img {
  background-color: #1f2937;
}

.zx-doc-thumb__pdf,
.zx-doc-thumb__file {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.dark .zx-doc-thumb__pdf,
.dark .zx-doc-thumb__file {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
}

.zx-doc-thumb__file {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

.dark .zx-doc-thumb__file {
  background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

.zx-doc-thumb__pdf-icon {
  font-size: 0.625rem;
  font-weight: 700;
  color: #b91c1c;
}

.dark .zx-doc-thumb__pdf-icon {
  color: #fecaca;
}

.zx-doc-thumb__file-icon {
  font-size: 1rem;
  line-height: 1;
}

.zx-doc-thumb__name {
  display: block;
  padding: 0.25rem 0.375rem;
  font-size: 0.625rem;
  line-height: 1.25;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .zx-doc-thumb__name {
  color: #e5e7eb;
}

.zx-doc-toolbar-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: 1px solid var(--color-primary-600, #2563eb);
  color: var(--color-primary-700, #1d4ed8);
  background-color: #eef2f9;
  cursor: pointer;
}

.zx-doc-toolbar-btn:hover:not(:disabled) {
  background-color: #dbeafe;
}

.zx-doc-toolbar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.zx-doc-toolbar-btn--muted {
  border-color: #d1d5db;
  color: #4b5563;
  background-color: #fff;
}

.zx-doc-toolbar-btn--muted:hover:not(:disabled) {
  background-color: #f3f4f6;
}

.dark .zx-doc-toolbar-btn {
  border-color: var(--color-primary-500, #3b82f6);
  color: #93c5fd;
  background-color: #1e3a5f;
}

.dark .zx-doc-toolbar-btn--muted {
  border-color: #4b5563;
  color: #d1d5db;
  background-color: #374151;
}

.zx-panel-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
}

.dark .zx-panel-warning {
  background-color: #451a03;
  border-color: #b45309;
}

/* Approval flow history steps */
.zx-flow-step {
  background-color: #f9fafb;
}

.dark .zx-flow-step {
  background-color: #1f2937;
}

.zx-flow-step--current {
  background-color: #eef2f9;
  box-shadow: 0 0 0 1px var(--color-primary-200);
}

.dark .zx-flow-step--current {
  background-color: #374151;
  box-shadow: 0 0 0 1px var(--color-primary-600);
}

/* Info banner (return to workbench, etc.) */
.zx-banner-info {
  background-color: #eef2f9;
  border: 1px solid #b3c5e1;
  color: var(--color-primary-900);
}

.zx-banner-info p {
  color: inherit;
}

.zx-banner-info a {
  color: var(--color-primary-700);
}

.zx-banner-info a:hover {
  color: var(--color-primary-800);
}

.dark .zx-banner-info {
  background-color: #17233b;
  border-color: #2f4779;
  color: #e5e7eb;
}

.dark .zx-banner-info a {
  color: var(--color-primary-200);
}

.dark .zx-banner-info a:hover {
  color: #fff;
}

/* Warning banner (admin edit of locked contract, etc.) */
.zx-banner-warning {
  background-color: #fffbeb;
  border: 1px solid #fcd34d;
  color: #78350f;
}

.dark .zx-banner-warning {
  background-color: #374151;
  border-color: #f59e0b;
  color: #fde68a;
}

/* Form controls on dark panels */
.dark .dark\:bg-gray-700 select,
.dark .dark\:bg-gray-800 select,
.dark .dark\:bg-gray-700 input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.dark .dark\:bg-gray-800 input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  color: #f3f4f6;
}

.dark input[type="file"] {
  color: #d1d5db;
}

.dark input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  background: #374151;
  color: #e5e7eb;
  font-size: 0.875rem;
  cursor: pointer;
}

.dark input[type="file"]::file-selector-button:hover {
  background: #4b5563;
}

/* Native date/time picker: clearer calendar/clock affordance */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"] {
  padding-right: 2.5rem;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
  width: 1.35rem;
  height: 1.35rem;
  margin-left: 0.25rem;
  padding: 0.2rem;
  cursor: pointer;
  opacity: 1;
  border-radius: 0.35rem;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.15rem 1.15rem;
  /* Calendar glyph (dark stroke for light surfaces) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 3v4'/%3E%3Cpath d='M16 3v4'/%3E%3C/svg%3E");
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
  background-color: rgba(15, 23, 42, 0.08);
}

.dark input[type="date"],
.dark input[type="datetime-local"],
.dark input[type="time"],
.dark input[type="month"],
.dark input[type="week"] {
  color-scheme: dark;
}

.dark input[type="date"]::-webkit-calendar-picker-indicator,
.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.dark input[type="time"]::-webkit-calendar-picker-indicator,
.dark input[type="month"]::-webkit-calendar-picker-indicator,
.dark input[type="week"]::-webkit-calendar-picker-indicator {
  /* Light stroke for dark surfaces */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 3v4'/%3E%3Cpath d='M16 3v4'/%3E%3C/svg%3E");
  filter: none;
  opacity: 1;
}

.dark input[type="date"]::-webkit-calendar-picker-indicator:hover,
.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
.dark input[type="time"]::-webkit-calendar-picker-indicator:hover,
.dark input[type="month"]::-webkit-calendar-picker-indicator:hover,
.dark input[type="week"]::-webkit-calendar-picker-indicator:hover {
  background-color: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

/* Vanilla Calendar Pro (inputMode popup) */
[data-vc="calendar"] {
  z-index: 80;
}

input[data-zx-datepicker],
input.zx-datepicker-input {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 3v4'/%3E%3Cpath d='M16 3v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.15rem 1.15rem;
  cursor: pointer;
}

.dark input[data-zx-datepicker],
.dark input.zx-datepicker-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 3v4'/%3E%3Cpath d='M16 3v4'/%3E%3C/svg%3E");
}

/* Primary action links without explicit dark: variant */
.dark a.text-primary-600,
.dark a.text-primary-700 {
  color: var(--color-primary-200);
}

.dark a.text-primary-600:hover,
.dark a.text-primary-700:hover {
  color: #fff;
}

.dark button.text-red-600 {
  color: #f87171;
}

/* Approval workbench layout */
.zx-approval-workbench-main {
  width: 100%;
}

.zx-approval-action-bar {
  gap: 0.5rem;
}

.zx-approval-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
  border: 1px solid transparent;
  min-height: 2.5rem;
}

.zx-approval-btn--edit {
  color: #fff;
  background-color: #b45309;
}

.zx-approval-btn--edit:hover {
  background-color: #92400e;
}

.zx-approval-btn--approve {
  color: #fff;
  background-color: #15803d;
}

.zx-approval-btn--approve:hover {
  background-color: #166534;
}

.zx-approval-btn--reject {
  color: #fff;
  background-color: #b91c1c;
}

.zx-approval-btn--reject:hover {
  background-color: #991b1b;
}

.zx-approval-btn--dynamic {
  color: #111827;
  background-color: #fff;
  border-color: #d1d5db;
}

.zx-approval-btn--dynamic:hover {
  background-color: #f9fafb;
}

.dark .zx-approval-btn--dynamic {
  color: #f9fafb;
  background-color: #374151;
  border-color: #4b5563;
}

.dark .zx-approval-btn--dynamic:hover {
  background-color: #4b5563;
}

.zx-approval-mobile-bar {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .zx-approval-mobile-bar {
    display: none !important;
  }
}

.zx-approval-flow-row--current {
  background-color: #eef2f9;
}

.dark .zx-approval-flow-row--current {
  background-color: #1e3a5f;
}

.zx-approval-flow-table tbody tr.zx-approval-flow-row--current td {
  color: #f9fafb;
}

.zx-flow-handler-current-label {
  color: #1d4ed8;
  font-weight: 600;
}

.dark .zx-flow-handler-current-label {
  color: #bfdbfe;
}

.zx-approval-flow-row--current .zx-flow-handler-current-label {
  color: #dbeafe;
}

.zx-flow-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.zx-flow-icon--approved {
  background-color: #16a34a;
  color: #fff;
  font-weight: 700;
}

.zx-flow-icon--withdrawn {
  background-color: #f59e0b;
  color: #fff;
  font-weight: 700;
}

.dark .zx-flow-icon--withdrawn {
  background-color: #d97706;
}

.zx-flow-icon--cc {
  background-color: #2563eb;
  color: #fff;
  font-weight: 700;
}

.zx-approval-flow-row--cc td {
  background-color: #eff6ff;
}

.dark .zx-approval-flow-row--cc td {
  background-color: rgb(30 58 138 / 0.25);
}

.zx-flow-handler-name {
  color: inherit;
}

.zx-flow-handler-time {
  color: #6b7280;
}

.dark .zx-flow-handler-time {
  color: #9ca3af;
}

.zx-approval-flow-row--current .zx-flow-handler-time {
  color: #d1d5db;
}

html, body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

[x-cloak] {
  display: none !important;
}

/* Sidebar active link */
.zx-nav-active {
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
}
.dark .zx-nav-active {
  background-color: rgba(59, 89, 152, 0.2);
  color: #fff;
}

/* Sign canvas */
.zx-sign-canvas-wrap {
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.dark .zx-sign-canvas-wrap {
  background: #fff;
  border-color: #94a3b8;
}
.zx-sign-canvas {
  display: block;
  width: 100%;
  height: 220px;
  touch-action: none;
  cursor: crosshair;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Inline signature slots (editor + sign session + PDF preview) */
.zx-sign-slot {
  display: inline !important;
  min-width: 3.2em;
  height: 1.35em;
  max-height: 1.6em;
  margin: 0 0.15em;
  padding: 0 0.45em;
  vertical-align: baseline;
  line-height: 1.35em;
  box-sizing: border-box;
  white-space: nowrap;
}

.zx-sign-slot::before {
  content: attr(data-label);
  color: #64748b;
  font-size: 0.75em;
}

.zx-sign-slot-label {
  font-size: 0.75em;
  color: #64748b;
  line-height: 1.2;
  white-space: nowrap;
}

.zx-sign-slot--pending {
  border: 1px dashed #94a3b8;
  border-radius: 0.2em;
  background: rgba(248, 250, 252, 0.9);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.zx-sign-slot--pending:hover,
.zx-sign-slot--pending:focus {
  border-color: var(--color-primary-600, #1d4ed8);
  background: #eff6ff;
  outline: none;
}

.dark .zx-sign-slot--pending {
  background: rgba(31, 41, 55, 0.9);
  border-color: #6b7280;
}

.dark .zx-sign-slot--pending::before {
  color: #e5e7eb;
}

.zx-sign-slot-hint {
  display: none;
}

/* Signed: zero-width anchor so underscores stay; ink floats above the line */
.zx-sign-slot--signed {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
  width: 0 !important;
  height: 1em !important;
  max-height: none !important;
  display: inline-block !important;
  position: relative;
  vertical-align: baseline;
  overflow: visible !important;
  white-space: nowrap;
  color: inherit;
}

.zx-sign-slot--signed::before {
  content: none !important;
}

.zx-sign-slot--signed .zx-sign-slot-img,
.zx-sign-slot-img {
  display: block !important;
  position: absolute;
  left: 0.1em;
  /* Sit on the baseline/underline; height is set in px by zx-sign-slot-layout.js */
  bottom: 0;
  height: 1em !important;
  width: auto !important;
  max-width: 3.5em !important;
  max-height: 1.05em !important;
  background: transparent;
  margin: 0;
  padding: 0;
  border: 0;
  z-index: 1;
  pointer-events: none;
}

/*
 * Mode A (default): inline / beside labels+underscores — float above the line
 *   (rules above: width:0 + absolute img). Applies inside AND outside tables.
 *
 * Mode B (.zx-sign-slot--cell): standalone slot that is the only content of a
 *   table cell — participate in layout so td text-align/vertical-align work.
 *   Class is stamped by zx-sign-slot-layout.js (not by "any td descendant").
 */
.zx-sign-slot--cell {
  vertical-align: middle;
}

.zx-sign-slot--cell.zx-sign-slot--signed {
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: none !important;
  display: inline-block !important;
  position: static !important;
  vertical-align: middle !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 0 !important;
}

.zx-sign-slot--cell.zx-sign-slot--signed .zx-sign-slot-img,
.zx-sign-slot--cell .zx-sign-slot-img {
  position: static !important;
  display: inline-block !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  vertical-align: middle;
  /* Fallback before JS measures cell height */
  height: 1.25em !important;
  max-height: 100% !important;
  width: auto !important;
  max-width: 7.5em !important;
}

/* Preview / UI only: invert dark ink so signatures stay readable on dark backgrounds.
   Does not alter stored PNG or PDF output (those use the original image bytes). */
.dark .zx-sign-slot--signed .zx-sign-slot-img,
.dark .zx-sign-document .zx-sign-slot-img,
.dark .zx-prose .zx-sign-slot-img,
.dark .zx-signature-preview__img {
  filter: invert(1);
}

/* Standalone signature preview (repair detail) — fixed pad size */
.zx-signature-preview {
  display: block;
  width: 100%;
  max-width: 28rem;
  min-height: 8.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  box-sizing: border-box;
}
.dark .zx-signature-preview {
  border-color: #4b5563;
  background-color: #111827;
}
.zx-signature-preview__img {
  display: block;
  width: 100%;
  height: 7rem;
  object-fit: contain;
  object-position: left center;
  background-color: transparent;
  border-radius: 0.25rem;
}

.zx-sign-document {
  font-size: 11pt;
  line-height: 1.5;
}

.zx-sign-document table {
  border-collapse: collapse;
  width: 100%;
}

.zx-sign-document td,
.zx-sign-document th {
  border: 1px solid #d1d5db;
  padding: 4px 8px;
  vertical-align: top;
}

/* CKEditor preview modal: full-width reading surface. */
.zx-ckeditor-preview-panel {
  max-width: 84rem;
}

.zx-ckeditor-preview-doc {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  font-family: "Microsoft JhengHei", "微軟正黑體", sans-serif;
  font-size: 11pt;
  line-height: 1.5;
  color: #1f2937;
  padding: 8px;
  box-sizing: border-box;
}

.dark .zx-ckeditor-preview-doc {
  color: #f3f4f6;
}

/* Restore editor-like block margins (Tailwind preflight zeroes these in the page). */
.zx-ckeditor-preview-doc p {
  margin: 0 0 1em;
}

.zx-ckeditor-preview-doc h1 {
  text-align: center;
  font-size: 24pt;
  font-weight: 700;
  margin-top: 12pt;
  margin-bottom: 15pt;
}

.zx-ckeditor-preview-doc h2 {
  font-size: 16pt;
  font-weight: 700;
  margin-top: 18.75pt;
  margin-bottom: 15pt;
}

.zx-ckeditor-preview-doc h3 {
  font-size: 14pt;
  font-weight: 700;
  margin-top: 15pt;
  margin-bottom: 12pt;
}

.zx-ckeditor-preview-doc table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75rem 0;
}

.zx-ckeditor-preview-doc table[align="center"],
.zx-ckeditor-preview-doc table[align="left"],
.zx-ckeditor-preview-doc table[align="right"] {
  width: auto !important;
  max-width: 100%;
}

.zx-ckeditor-preview-doc table[align="center"] {
  margin-left: auto !important;
  margin-right: auto !important;
}

.zx-ckeditor-preview-doc table[align="left"] {
  margin-left: 0 !important;
  margin-right: auto !important;
}

.zx-ckeditor-preview-doc table[align="right"] {
  margin-left: auto !important;
  margin-right: 0 !important;
}

.zx-ckeditor-preview-doc td,
.zx-ckeditor-preview-doc th {
  border: 1px solid #000;
  padding: 4px 8px;
  /* default only — explicit cell styles/attributes override via rules above */
  vertical-align: top;
}

.dark .zx-ckeditor-preview-doc td,
.dark .zx-ckeditor-preview-doc th {
  border-color: #d1d5db !important;
}

.zx-ckeditor-preview-doc ul {
  list-style-type: disc;
  list-style-position: outside;
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.zx-ckeditor-preview-doc ol {
  list-style-type: decimal;
  list-style-position: outside;
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.zx-ckeditor-preview-doc li {
  display: list-item;
}

.zx-sign-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.zx-sign-modal.hidden {
  display: none;
}

.zx-sign-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.zx-sign-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 42rem;
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.dark .zx-sign-modal-panel {
  background: #1f2937;
}

/* Wizard steps */
.zx-wizard-step.is-current .zx-wizard-num {
  background-color: var(--color-primary-600);
  color: #fff;
}
.zx-wizard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: #e5e7eb;
  font-size: 0.75rem;
  font-weight: 600;
}
.dark .zx-wizard-num { background: #374151; }

.zx-ckeditor-field {
  width: 100%;
  min-width: 0;
}

.zx-ckeditor-field .ck.ck-editor {
  width: 100%;
  max-width: 100%;
}

.zx-form-layout-cell .zx-ckeditor-field {
  width: 100%;
}

/* Fallback if ckeditor.css build omits @ckeditor/ckeditor5-ui base layout */
.zx-ckeditor-field .ck.ck-toolbar {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
}
.zx-ckeditor-field .ck.ck-toolbar > .ck-toolbar__items {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  flex-grow: 1;
}

.zx-ckeditor-field .ck-editor__editable {
  min-height: 280px;
}

/* Let toolbar dropdown panels extend below the toolbar without clipping */
.zx-ckeditor-field .ck.ck-editor,
.zx-ckeditor-field .ck.ck-editor__top,
.zx-ckeditor-field .ck.ck-sticky-panel,
.zx-ckeditor-field .ck.ck-sticky-panel__content,
.zx-ckeditor-field .ck.ck-toolbar {
  overflow: visible;
}

/* ck-reset_all sets position:static on all descendants — restore dropdown anchor */
.zx-ckeditor-field .ck.ck-toolbar .ck.ck-dropdown {
  position: relative;
  display: inline-block;
  width: auto;
  flex: 0 0 auto;
}

.zx-ckeditor-field .ck.ck-dropdown__panel {
  z-index: calc(var(--ck-z-panel, 10000) + 2);
  width: max-content;
  max-width: min(var(--ck-dropdown-max-width, 75vw), 22rem);
}

/* CKEditor floating UI (tooltips, dialogs) — keep above app chrome */
.ck-body-wrapper {
  position: relative;
  z-index: 10050;
}

.ck.ck-balloon-panel.ck-tooltip {
  --ck-color-tooltip-background: #1f2937;
  --ck-color-tooltip-text: #f9fafb;
  background: #1f2937;
  border: 1px solid #4b5563;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ck.ck-balloon-panel.ck-tooltip .ck-tooltip__text {
  color: #f9fafb;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: nowrap;
}

.dark .ck.ck-balloon-panel.ck-tooltip {
  --ck-color-tooltip-background: #111827;
  --ck-color-tooltip-text: #f3f4f6;
  background: #111827;
  border-color: #6b7280;
}

/* Table cell right-click context menu */
.zx-ck-table-context-menu {
  position: fixed;
  z-index: 10100;
  min-width: 11rem;
  padding: 0.25rem 0;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.zx-ck-table-context-menu__item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: left;
  cursor: pointer;
}

.zx-ck-table-context-menu__item:hover:not(:disabled),
.zx-ck-table-context-menu__item:focus-visible:not(:disabled) {
  background: #f3f4f6;
  outline: none;
}

.zx-ck-table-context-menu__item:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.zx-ck-table-context-menu__separator {
  height: 1px;
  margin: 0.25rem 0;
  background: #e5e7eb;
}

.dark .zx-ck-table-context-menu {
  border-color: #4b5563;
  background: #1f2937;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.dark .zx-ck-table-context-menu__item {
  color: #f9fafb;
}

.dark .zx-ck-table-context-menu__item:hover:not(:disabled),
.dark .zx-ck-table-context-menu__item:focus-visible:not(:disabled) {
  background: #374151;
}

.dark .zx-ck-table-context-menu__item:disabled {
  color: #6b7280;
}

.dark .zx-ck-table-context-menu__separator {
  background: #4b5563;
}

/* CKEditor dark theme — override Lark variables inside the editor chrome */
.dark .zx-ckeditor-field .ck.ck-editor {
  --ck-color-base-foreground: #1f2937;
  --ck-color-base-background: #374151;
  --ck-color-base-border: #4b5563;
  --ck-color-base-text: #f3f4f6;
  --ck-color-text: #f3f4f6;
  --ck-color-toolbar-background: #374151;
  --ck-color-toolbar-border: #4b5563;
  --ck-color-dropdown-panel-background: #374151;
  --ck-color-dropdown-panel-border: #4b5563;
  --ck-color-list-background: #374151;
  --ck-color-list-button-hover-background: #4b5563;
  --ck-color-list-button-on-background: #4b5563;
  --ck-color-list-button-on-background-focus: #6b7280;
  --ck-color-list-button-on-text: #f9fafb;
  --ck-color-button-default-hover-background: #4b5563;
  --ck-color-button-default-active-background: #4b5563;
  --ck-color-button-on-background: #4b5563;
  --ck-color-button-on-hover-background: #6b7280;
  --ck-color-button-on-active-background: #6b7280;
  --ck-color-button-on-color: #f9fafb;
  --ck-color-input-background: #1f2937;
  --ck-color-input-border: #4b5563;
  --ck-color-input-text: #f3f4f6;
  --ck-color-focus-outer-shadow: rgba(74, 110, 175, 0.35);
  --ck-color-shadow-drop: rgba(0, 0, 0, 0.35);
  --ck-color-shadow-inner: rgba(0, 0, 0, 0.2);
}

.dark .zx-ckeditor-field .ck.ck-toolbar,
.dark .zx-ckeditor-field .ck.ck-toolbar.zx-ck-dark {
  background: #374151;
  border-color: #4b5563;
}

/* Toolbar buttons only — do not bleed light text into dropdown list items */
.dark .zx-ckeditor-field .ck.ck-toolbar > .ck-toolbar__items > .ck-button:not(.ck-dropdown__button),
.dark .zx-ckeditor-field .ck.ck-toolbar > .ck-toolbar__items > .ck-dropdown > .ck-dropdown__button {
  color: #e5e7eb;
}

.dark .zx-ckeditor-field .ck.ck-dropdown__panel .ck-button,
.dark .zx-ckeditor-field .ck.ck-dropdown__panel .ck-list-item-button {
  color: #f3f4f6;
}

.dark .zx-ckeditor-field .ck.ck-dropdown__panel .ck-button .ck-button__label {
  color: inherit;
}

.dark .zx-ckeditor-field .ck.ck-editor__main > .ck-editor__editable,
.dark .zx-ckeditor-field .ck-editor__editable.zx-ck-dark {
  background: #1f2937;
  color: #f3f4f6;
  border-color: #4b5563;
}
.dark .zx-ckeditor-field .ck.ck-editor__main > .ck-editor__editable:not(.ck-focused) {
  border-color: #4b5563;
}
.dark .zx-ckeditor-field .ck.ck-editor__editable.ck-focused {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 2px rgba(74, 110, 175, 0.35);
}

/* CKEditor page break — editor widget (theme CSS omitted from bundle) */
.zx-ckeditor-field .ck-content .page-break {
  position: relative;
  clear: both;
  padding: 10px 0;
  margin: 14px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zx-ckeditor-field .ck-content .page-break::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 2px dashed #9ca3af;
  pointer-events: none;
}
.zx-ckeditor-field .ck-content .page-break__label {
  position: relative;
  z-index: 1;
  padding: 2px 12px;
  font-size: 0;
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  user-select: none;
}
.zx-ckeditor-field .ck-content .page-break__label::before {
  content: '------- 分頁 -------';
  font-size: 12px;
  letter-spacing: 0.05em;
}
.dark .zx-ckeditor-field .ck-content .page-break::before {
  border-top-color: #6b7280;
}
.dark .zx-ckeditor-field .ck-content .page-break__label {
  color: #d1d5db;
  background: #374151;
  border-color: #4b5563;
}

/* CKEditor page break — saved HTML / preview */
.zx-ckeditor-field .ck-content .page-break:not(:has(.page-break__label)),
.zx-prose .page-break,
.zx-sign-document .page-break {
  position: relative;
  clear: both;
  padding: 10px 0;
  margin: 14px 0;
  border: none;
  page-break-after: always;
  break-after: page;
}
.zx-ckeditor-field .ck-content .page-break:not(:has(.page-break__label))::before,
.zx-prose .page-break::before,
.zx-sign-document .page-break::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 2px dashed #9ca3af;
}
.zx-ckeditor-field .ck-content .page-break:not(:has(.page-break__label))::after,
.zx-prose .page-break::after,
.zx-sign-document .page-break::after {
  content: '------- 分頁 -------';
  display: block;
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 0 auto;
  padding: 2px 12px;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  letter-spacing: 0.05em;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.dark .zx-ckeditor-field .ck-content .page-break:not(:has(.page-break__label))::before,
.dark .zx-prose .page-break::before {
  border-top-color: #6b7280;
}
.dark .zx-ckeditor-field .ck-content .page-break:not(:has(.page-break__label))::after,
.dark .zx-prose .page-break::after {
  color: #d1d5db;
  background: #374151;
  border-color: #4b5563;
}

@media print {
  .page-break,
  div.page-break {
    page-break-after: always !important;
    break-after: page !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .page-break::before,
  .page-break::after,
  div.page-break::before,
  div.page-break::after,
  .page-break__label {
    content: none !important;
    display: none !important;
  }
}

/* --- Org units data list (TDMS data-table-panel structure) --- */
.zx-data-list-page .zx-data-toolbar h1 {
  margin: 0;
}
.zx-table-th {
  padding: 0.75rem 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.zx-data-table-panel .zx-data-row {
  transition: background-color 0.12s ease;
}

.zx-data-table-panel .zx-data-row:hover {
  background-color: #f1f5f9;
}

.dark .zx-data-table-panel .zx-data-row:hover {
  background-color: #334155;
}

.dark .zx-data-table-panel .zx-data-row:hover td {
  color: #f9fafb;
}

.dark .zx-data-table-panel .zx-data-row:hover .text-primary-600,
.dark .zx-data-table-panel .zx-data-row:hover .text-primary-400 {
  color: #93c5fd;
}

.dark .zx-data-table-panel .zx-data-row:hover .text-yellow-600,
.dark .zx-data-table-panel .zx-data-row:hover .text-yellow-400 {
  color: #fcd34d;
}

.dark .zx-data-table-panel .zx-data-row:hover .text-red-600,
.dark .zx-data-table-panel .zx-data-row:hover .text-red-400 {
  color: #fca5a5;
}

/* --- Org chart (view structure): nodes & connectors --- */
.org-chart-page {
  --org-chart-line: var(--color-primary-600);
  --org-chart-line-glow: color-mix(in srgb, var(--color-primary-400) 45%, transparent);
  --org-chart-node-border: color-mix(in srgb, var(--color-primary-500) 55%, #cbd5e1);
  --org-chart-root-dash: color-mix(in srgb, var(--color-primary-400) 40%, #94a3b8);
}

.org-chart-root-drop {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 2px dashed var(--org-chart-root-dash);
  border-radius: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.dark .org-chart-root-drop {
  color: #94a3b8;
}

.org-chart-root-drop--active {
  border-color: var(--color-primary-600);
  background: var(--color-primary-50);
  color: #1e293b;
}

.dark .org-chart-root-drop--active {
  background: color-mix(in srgb, var(--color-primary-900) 40%, #1f2937);
  color: #e2e8f0;
}

.org-chart-dnd-canvas {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  padding: 8px 4px 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.org-chart-forest {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  min-width: min-content;
  width: max-content;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

.org-chart-subtree {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 100%;
}

.org-chart-stem {
  width: 3px;
  height: 14px;
  border-radius: 0;
  background: var(--org-chart-line);
  box-shadow: 0 0 5px var(--org-chart-line-glow);
  flex-shrink: 0;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

.org-chart-children {
  --org-sibling-gap: 20px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  gap: var(--org-sibling-gap);
  align-items: flex-start;
  justify-content: center;
  padding-top: 0;
  min-width: min-content;
  width: max-content;
  max-width: 100%;
  align-self: center;
  box-sizing: border-box;
}

.org-chart-child-branch::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0;
  background: var(--org-chart-line);
  box-shadow: 0 0 5px var(--org-chart-line-glow);
  pointer-events: none;
  z-index: 2;
}

.org-chart-child-branch:only-child::before {
  display: none;
}

.org-chart-child-branch:first-child:not(:only-child)::before {
  left: 50%;
  right: calc(var(--org-sibling-gap) / -2 - 1px);
}

.org-chart-child-branch:last-child:not(:only-child)::before {
  left: calc(var(--org-sibling-gap) / -2 - 1px);
  right: 50%;
}

.org-chart-child-branch:not(:first-child):not(:last-child):not(:only-child)::before {
  left: calc(var(--org-sibling-gap) / -2 - 1px);
  right: calc(var(--org-sibling-gap) / -2 - 1px);
}

.org-chart-child-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
  width: max-content;
  min-width: 148px;
  max-width: none;
  padding: 4px 6px 0;
  overflow: visible;
  box-sizing: border-box;
}

.org-chart-child-branch:only-child {
  padding-top: 0;
}

.org-chart-branch-line {
  width: 3px;
  height: 13px;
  margin-top: -3px;
  border-radius: 0;
  background: var(--org-chart-line);
  box-shadow: 0 0 5px var(--org-chart-line-glow);
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

.org-chart-card {
  min-width: 148px;
  max-width: 228px;
  padding: 10px 12px;
  border-radius: 0.5rem;
  border: 2px solid var(--org-chart-node-border);
  background: #fff;
  color: #111827;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px color-mix(in srgb, var(--org-chart-line) 22%, transparent);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  touch-action: none;
  position: relative;
  z-index: 4;
}

.dark .org-chart-card {
  background: #1f2937;
  color: #f3f4f6;
}

.org-chart-card:active {
  cursor: grabbing;
}

.org-chart-card--over {
  outline: 2px solid var(--color-primary-400);
  border-color: var(--color-primary-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary-500) 25%, transparent);
}

.org-chart-card--dragging {
  opacity: 0.45;
}

.org-chart-card-code {
  font-weight: 600;
  font-size: 0.82rem;
  color: #64748b;
}

.dark .org-chart-card-code {
  color: #94a3b8;
}

.org-chart-card-name {
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.35;
  font-size: 0.95rem;
}

.org-chart-card-mgr {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 6px;
}

.dark .org-chart-card-mgr {
  color: #94a3b8;
}

.org-chart-card--people {
  max-width: 260px;
}

.org-chart-card-members {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px 0 0;
  text-align: left;
  font-size: 0.72rem;
  border-top: 1px solid color-mix(in srgb, #cbd5e1 70%, transparent);
}

.dark .org-chart-card-members {
  border-top-color: #374151;
}

.org-chart-card-members li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  line-height: 1.35;
}

.org-chart-card-member-name {
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-chart-card-member-no {
  color: #64748b;
  flex-shrink: 0;
}

.org-chart-card-members-empty {
  color: #64748b;
  justify-content: center !important;
}

@media print {
  .org-chart-card {
    cursor: default;
    break-inside: avoid;
  }
}

.zx-field-tooltip {
  max-width: 18rem;
  text-align: left;
  white-space: pre-line;
  line-height: 1.45;
}

.zx-form-layout-editor .zx-form-layout-cell {
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: rgba(248, 250, 252, 0.6);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.zx-form-layout-editor .zx-form-layout-cell :is(button, a, input, select, textarea, label) {
  cursor: auto;
  user-select: auto;
}

.zx-form-layout-editor .zx-form-layout-cell :is(button, a) {
  cursor: pointer;
}

.dark .zx-form-layout-editor .zx-form-layout-cell {
  border-color: #4b5563;
  background: rgba(31, 41, 55, 0.45);
}

.zx-form-layout-editor.zx-layout-is-dragging .zx-form-layout-cell:not(.zx-layout-dragging) {
  opacity: 0.72;
}

.zx-form-layout-editor .zx-form-layout-cell.zx-layout-dragging {
  opacity: 0.35;
  cursor: grabbing;
  border-style: solid;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary-500) 35%, transparent);
}

.zx-form-layout-editor .zx-form-layout-cell.zx-layout-drag-over {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary-500) 45%, transparent);
}

.zx-form-layout-editor .zx-layout-drop-placeholder {
  min-height: 3.5rem;
  border: 2px dashed var(--color-primary-500);
  border-radius: 0.5rem;
  background:
    repeating-linear-gradient(
      -45deg,
      color-mix(in srgb, var(--color-primary-500) 18%, transparent),
      color-mix(in srgb, var(--color-primary-500) 18%, transparent) 8px,
      color-mix(in srgb, var(--color-primary-400) 10%, transparent) 8px,
      color-mix(in srgb, var(--color-primary-400) 10%, transparent) 16px
    );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary-500) 40%, transparent);
}

.zx-form-layout-editor .zx-layout-drop-placeholder-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-primary-700);
  background: color-mix(in srgb, #fff 88%, var(--color-primary-100));
  border: 1px solid var(--color-primary-400);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.dark .zx-form-layout-editor .zx-layout-drop-placeholder-label {
  color: var(--color-primary-100);
  background: color-mix(in srgb, #111827 75%, var(--color-primary-700));
  border-color: var(--color-primary-400);
}

.zx-form-layout-editor .zx-form-layout-cell.zx-layout-just-moved {
  animation: zx-layout-moved-flash 0.65s ease;
}

@keyframes zx-layout-moved-flash {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary-500) 55%, transparent);
    border-color: var(--color-primary-500);
  }
  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

.repair-receipt h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.repair-receipt .meta {
  font-size: 0.875rem;
  color: #4b5563;
  margin-bottom: 0.35rem;
}
.dark .repair-receipt .meta {
  color: #9ca3af;
}
.repair-receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 1rem;
}
.repair-receipt-table th,
.repair-receipt-table td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.65rem;
}
.dark .repair-receipt-table th,
.dark .repair-receipt-table td {
  border-color: #4b5563;
}
.repair-receipt-table th {
  background: #f3f4f6;
  text-align: left;
}
.dark .repair-receipt-table th {
  background: #374151;
}
.repair-receipt-table .num {
  text-align: right;
}
.repair-receipt-table .total-label,
.repair-receipt-table .total {
  font-weight: 600;
}
.repair-receipt-table .empty {
  text-align: center;
  color: #6b7280;
}
.repair-receipt-sign {
  margin-top: 1rem;
}
.repair-receipt-sign-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.75rem;
  page-break-inside: avoid;
}
.repair-receipt-sign-slot {
  flex: 1 1 12rem;
  min-width: 10rem;
}
.repair-receipt-sign-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: #111827;
}
.dark .repair-receipt-sign-label {
  color: #e5e7eb;
}
.repair-receipt-sign-box {
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  min-height: 4.5rem;
  padding: 0.375rem 0.5rem;
  background: #fff;
}
.dark .repair-receipt-sign-box {
  border-color: #4b5563;
  background: #111827;
}
.repair-receipt-sign-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}
.dark .repair-receipt-sign-meta {
  color: #9ca3af;
}
.repair-receipt-sign-img {
  display: block;
  max-height: 4.5rem;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  background: #fff;
}
.dark .repair-receipt-sign-img {
  background: #fff;
}
