/* ==========================================================================
   CUSTOM FORM STYLES (Activated by .custom-shell / .custom-form-wrapper)
   Adaptive for SIXT Light Theme (default) and Dark Theme
   ========================================================================== */

:root,
[data-theme="light"] {
  --custom-brand: #ff5f00;
  --custom-brand-blue: #1d4ed8;
  --custom-bg-shell: #f4f5f7;
  --custom-bg-card: #ffffff;
  --custom-bg-header: #f3f4f6;
  --custom-bg-input: #ffffff;
  --custom-border: #e5e7eb;
  --custom-text: #111827;
  --custom-text-muted: #6b7280;
  --custom-text-info: #0284c7;
  --custom-text-warning: #d97706;
}

[data-theme="dark"] {
  --custom-brand: #ff5f00;
  --custom-brand-blue: #1d4ed8;
  --custom-bg-shell: #0b1224;
  --custom-bg-card: #1e293b;
  --custom-bg-header: #0f172a;
  --custom-bg-input: #0f172a;
  --custom-border: #334155;
  --custom-text: #f8fafc;
  --custom-text-muted: #94a3b8;
  --custom-text-info: #38bdf8;
  --custom-text-warning: #facc15;
}

/* Outer Shell & Screen */
.custom-shell {
  width: 100%;
  overflow-x: auto;
  background: var(--custom-bg-shell);
  border-radius: 0.5rem;
  box-sizing: border-box;
}

[data-theme="dark"] .custom-shell {
  background: linear-gradient(180deg, #0b1224 0%, #0f172a 40%, #182a4f 100%);
}

.custom-screen {
  display: block;
  width: 100%;
  min-width: 100%;
}

/* Wrapper */
.custom-form-wrapper {
  background-color: transparent;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--custom-text);
}

/* Brand & Form Top Header */
.custom-form-header {
  background: var(--custom-bg-header);
  border: 1px solid var(--custom-border);
  border-left: 5px solid var(--custom-brand) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .custom-form-header {
  background: linear-gradient(135deg, #0b1224 0%, #0f172a 60%, #1e293b 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.custom-form-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.custom-form-title {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--custom-text) !important;
}

/* Section Cards */
.custom-form-wrapper .custom-section-card,
.custom-form-wrapper .custom-subform-card,
.custom-section-card,
.custom-subform-card {
  background-color: var(--custom-bg-card) !important;
  border: 1px solid var(--custom-border) !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
}

.custom-form-wrapper .card-header,
.custom-section-card > .card-header,
.custom-subform-card > .card-header {
  background: var(--custom-bg-header) !important;
  border-bottom: 1px solid var(--custom-border) !important;
  border-left: 4px solid var(--custom-brand) !important;
  color: var(--custom-text) !important;
}

.custom-form-wrapper .card-header h6,
.custom-section-card > .card-header h6,
.custom-subform-card > .card-header h6 {
  color: var(--custom-text) !important;
}

[data-theme="dark"] .custom-form-wrapper .card-header,
[data-theme="dark"] .custom-section-card > .card-header,
[data-theme="dark"] .custom-subform-card > .card-header {
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%) !important;
}

.custom-form-wrapper .custom-subform-card .card-header,
.custom-subform-card > .card-header {
  border-left-color: var(--custom-brand-blue) !important;
}

/* Form Labels */
.custom-form-wrapper .form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--custom-text-muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}

/* Base Form Inputs & Selects */
.custom-form-wrapper .form-control,
.custom-form-wrapper .form-select {
  background-color: var(--custom-bg-input) !important;
  color: var(--custom-text) !important;
  border: 1px solid var(--custom-border) !important;
  border-radius: 0.375rem !important;
  font-size: 0.875rem !important;
  padding: 0.4rem 0.65rem !important;
  box-shadow: none !important;
  height: auto !important;
  line-height: 1.5 !important;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.custom-form-wrapper .form-control:focus,
.custom-form-wrapper .form-select:focus {
  background-color: var(--custom-bg-input) !important;
  color: var(--custom-text) !important;
  border-color: var(--custom-brand) !important;
  box-shadow: 0 0 0 3px rgba(255, 95, 0, 0.2) !important;
  outline: 0 !important;
}

[data-theme="light"] .custom-form-wrapper .form-control[readonly] {
  background-color: #f9fafb !important;
  color: #6b7280 !important;
  border-color: #e5e7eb !important;
  cursor: not-allowed;
}

[data-theme="dark"] .custom-form-wrapper .form-control[readonly] {
  background-color: #090d16 !important;
  color: #64748b !important;
  border-color: #1e293b !important;
  cursor: not-allowed;
}

.custom-form-wrapper .form-control.text-end {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Dropdown arrow */
[data-theme="light"] .custom-form-wrapper select.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M8 11.5l-5-5h10l-5 5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 12px 12px !important;
  padding-right: 2.25rem !important;
}

[data-theme="dark"] .custom-form-wrapper select.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M8 11.5l-5-5h10l-5 5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 12px 12px !important;
  padding-right: 2.25rem !important;
}

.custom-form-wrapper select.form-select option {
  background-color: var(--custom-bg-input) !important;
  color: var(--custom-text) !important;
}

/* ==========================================================================
   DOS-INSPIRED FIELD HIGHLIGHTS (Theme-Aware: Light & Dark)
   ========================================================================== */

/* Light Theme Field Highlights */
[data-theme="light"] .custom-form-wrapper .custom-field--h0 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h0 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h0,
[data-theme="light"] .custom-form-wrapper select.custom-field--h0,
[data-theme="light"] .custom-form-wrapper .dos-field--h0 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h0 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h0,
[data-theme="light"] .custom-form-wrapper select.dos-field--h0 {
  background-color: var(--custom-bg-input) !important;
  border-color: var(--custom-border) !important;
  color: var(--custom-text) !important;
}
[data-theme="light"] .custom-form-wrapper .custom-field--h0 input:focus,
[data-theme="light"] .custom-form-wrapper .custom-field--h0 select:focus,
[data-theme="light"] .custom-form-wrapper input.custom-field--h0:focus,
[data-theme="light"] .custom-form-wrapper select.custom-field--h0:focus {
  border-color: var(--custom-brand) !important;
  box-shadow: 0 0 0 3px rgba(255, 95, 0, 0.2) !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h1 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h1 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h1,
[data-theme="light"] .custom-form-wrapper select.custom-field--h1,
[data-theme="light"] .custom-form-wrapper .custom-field--h2 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h2 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h2,
[data-theme="light"] .custom-form-wrapper select.custom-field--h2,
[data-theme="light"] .custom-form-wrapper .dos-field--h1 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h1 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h1,
[data-theme="light"] .custom-form-wrapper select.dos-field--h1,
[data-theme="light"] .custom-form-wrapper .dos-field--h2 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h2 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h2,
[data-theme="light"] .custom-form-wrapper select.dos-field--h2 {
  background-color: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #991b1b !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h3 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h3 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h3,
[data-theme="light"] .custom-form-wrapper select.custom-field--h3,
[data-theme="light"] .custom-form-wrapper .dos-field--h3 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h3 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h3,
[data-theme="light"] .custom-form-wrapper select.dos-field--h3 {
  background-color: #fffbeb !important;
  border-color: #fcd34d !important;
  color: #92400e !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h5 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h5 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h5,
[data-theme="light"] .custom-form-wrapper select.custom-field--h5,
[data-theme="light"] .custom-form-wrapper .custom-field--h6 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h6 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h6,
[data-theme="light"] .custom-form-wrapper select.custom-field--h6,
[data-theme="light"] .custom-form-wrapper .dos-field--h5 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h5 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h5,
[data-theme="light"] .custom-form-wrapper select.dos-field--h5,
[data-theme="light"] .custom-form-wrapper .dos-field--h6 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h6 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h6,
[data-theme="light"] .custom-form-wrapper select.dos-field--h6 {
  background-color: #ecfeff !important;
  border-color: #67e8f9 !important;
  color: #155e75 !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h7 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h7 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h7,
[data-theme="light"] .custom-form-wrapper select.custom-field--h7,
[data-theme="light"] .custom-form-wrapper .dos-field--h7 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h7 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h7,
[data-theme="light"] .custom-form-wrapper select.dos-field--h7 {
  background-color: #fef2f2 !important;
  border-color: #f87171 !important;
  color: #b91c1c !important;
  font-weight: bold !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h8 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h8 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h8,
[data-theme="light"] .custom-form-wrapper select.custom-field--h8,
[data-theme="light"] .custom-form-wrapper .dos-field--h8 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h8 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h8,
[data-theme="light"] .custom-form-wrapper select.dos-field--h8 {
  background-color: #f0fdf4 !important;
  border-color: #86efac !important;
  color: #166534 !important;
  font-weight: bold !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h9 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h9 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h9,
[data-theme="light"] .custom-form-wrapper select.custom-field--h9,
[data-theme="light"] .custom-form-wrapper .dos-field--h9 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h9 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h9,
[data-theme="light"] .custom-form-wrapper select.dos-field--h9 {
  background-color: #faf5ff !important;
  border-color: #d8b4fe !important;
  color: #6b21a8 !important;
}

[data-theme="light"] .custom-form-wrapper .custom-field--h10 input,
[data-theme="light"] .custom-form-wrapper .custom-field--h10 select,
[data-theme="light"] .custom-form-wrapper input.custom-field--h10,
[data-theme="light"] .custom-form-wrapper select.custom-field--h10,
[data-theme="light"] .custom-form-wrapper .dos-field--h10 input,
[data-theme="light"] .custom-form-wrapper .dos-field--h10 select,
[data-theme="light"] .custom-form-wrapper input.dos-field--h10,
[data-theme="light"] .custom-form-wrapper select.dos-field--h10 {
  background-color: #eff6ff !important;
  border-color: #93c5fd !important;
  color: #1e40af !important;
  font-weight: bold !important;
}

/* Dark Theme Field Highlights */
[data-theme="dark"] .custom-form-wrapper .custom-field--h0 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h0 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h0,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h0,
[data-theme="dark"] .custom-form-wrapper .dos-field--h0 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h0 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h0,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h0 {
  background-color: #0b162c !important;
  border-color: #1e3a8a !important;
  color: #fef08a !important;
}
[data-theme="dark"] .custom-form-wrapper .custom-field--h0 input:focus,
[data-theme="dark"] .custom-form-wrapper .custom-field--h0 select:focus,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h0:focus,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h0:focus {
  border-color: #eab308 !important;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.25) !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h1 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h1 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h1,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h1,
[data-theme="dark"] .custom-form-wrapper .custom-field--h2 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h2 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h2,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h2,
[data-theme="dark"] .custom-form-wrapper .dos-field--h1 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h1 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h1,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h1,
[data-theme="dark"] .custom-form-wrapper .dos-field--h2 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h2 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h2,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h2 {
  background-color: #2b1114 !important;
  border-color: #ef4444 !important;
  color: #fecaca !important;
}
[data-theme="dark"] .custom-form-wrapper .custom-field--h1 input:focus,
[data-theme="dark"] .custom-form-wrapper .custom-field--h1 select:focus,
[data-theme="dark"] .custom-form-wrapper .custom-field--h2 input:focus,
[data-theme="dark"] .custom-form-wrapper .custom-field--h2 select:focus {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h3 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h3 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h3,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h3,
[data-theme="dark"] .custom-form-wrapper .dos-field--h3 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h3 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h3,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h3 {
  background-color: #020617 !important;
  border-color: #eab308 !important;
  color: #facc15 !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h5 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h5 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h5,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h5,
[data-theme="dark"] .custom-form-wrapper .dos-field--h5 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h5 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h5,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h5 {
  background-color: #082f49 !important;
  border-color: #06b6d4 !important;
  color: #cffafe !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h6 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h6 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h6,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h6,
[data-theme="dark"] .custom-form-wrapper .dos-field--h6 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h6 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h6,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h6 {
  background-color: #020617 !important;
  border-color: #06b6d4 !important;
  color: #22d3ee !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h7 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h7 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h7,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h7,
[data-theme="dark"] .custom-form-wrapper .dos-field--h7 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h7 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h7,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h7 {
  background-color: #020617 !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
  font-weight: bold !important;
}
[data-theme="dark"] .custom-form-wrapper .custom-field--h7 input:focus,
[data-theme="dark"] .custom-form-wrapper .custom-field--h7 select:focus {
  border-color: #ff5555 !important;
  box-shadow: 0 0 0 3px rgba(255, 85, 85, 0.3) !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h8 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h8 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h8,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h8,
[data-theme="dark"] .custom-form-wrapper .dos-field--h8 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h8 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h8,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h8 {
  background-color: #052e16 !important;
  border-color: #22c55e !important;
  color: #86efac !important;
  font-weight: bold !important;
}
[data-theme="dark"] .custom-form-wrapper .custom-field--h8 input:focus,
[data-theme="dark"] .custom-form-wrapper .custom-field--h8 select:focus {
  border-color: #4ade80 !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3) !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h9 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h9 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h9,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h9,
[data-theme="dark"] .custom-form-wrapper .dos-field--h9 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h9 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h9,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h9 {
  background-color: #2e1065 !important;
  border-color: #d946ef !important;
  color: #f5d0fe !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-field--h10 input,
[data-theme="dark"] .custom-form-wrapper .custom-field--h10 select,
[data-theme="dark"] .custom-form-wrapper input.custom-field--h10,
[data-theme="dark"] .custom-form-wrapper select.custom-field--h10,
[data-theme="dark"] .custom-form-wrapper .dos-field--h10 input,
[data-theme="dark"] .custom-form-wrapper .dos-field--h10 select,
[data-theme="dark"] .custom-form-wrapper input.dos-field--h10,
[data-theme="dark"] .custom-form-wrapper select.dos-field--h10 {
  background-color: #172554 !important;
  border-color: #3b82f6 !important;
  color: #fde047 !important;
  font-weight: bold !important;
}

/* Subform Tables */
.custom-form-wrapper .table-dark {
  background-color: var(--custom-bg-card) !important;
  border-color: var(--custom-border) !important;
  color: var(--custom-text) !important;
}

.custom-form-wrapper .table-dark thead th {
  background-color: var(--custom-bg-header) !important;
  color: var(--custom-text-info) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid var(--custom-border) !important;
  padding: 0.6rem 0.75rem !important;
}

[data-theme="light"] .custom-form-wrapper .table-dark thead th {
  background-color: #f9fafb !important;
  color: #374151 !important;
}

.custom-form-wrapper .table-dark tbody td {
  border-color: var(--custom-border) !important;
  background-color: var(--custom-bg-card) !important;
  color: var(--custom-text) !important;
  padding: 0.5rem 0.75rem !important;
}

[data-theme="light"] .custom-form-wrapper .table-striped tbody tr:nth-of-type(odd) td {
  background-color: #f9fafb !important;
}

[data-theme="dark"] .custom-form-wrapper .table-striped tbody tr:nth-of-type(odd) td {
  background-color: #182234 !important;
}

[data-theme="light"] .custom-form-wrapper .table-hover tbody tr:hover td {
  background-color: #f3f4f6 !important;
}

[data-theme="dark"] .custom-form-wrapper .table-hover tbody tr:hover td {
  background-color: #243048 !important;
}

/* Theme-Aware Semantic Badges & Subform Tables */
.custom-form-wrapper .custom-page-badge,
.custom-form-wrapper .custom-subform-badge {
  background-color: var(--custom-bg-header) !important;
  color: var(--custom-text-info) !important;
  border: 1px solid var(--custom-border) !important;
}

.custom-form-wrapper .custom-subform-table,
.custom-form-wrapper .app-table {
  color: var(--custom-text) !important;
  border-color: var(--custom-border) !important;
}

.custom-form-wrapper .custom-subform-table thead th,
.custom-form-wrapper .app-table thead th {
  background-color: var(--custom-bg-header) !important;
  color: var(--custom-text-muted) !important;
  border-bottom: 1px solid var(--custom-border) !important;
  padding: 0.6rem 0.75rem !important;
}

.custom-form-wrapper .custom-subform-table tbody td,
.custom-form-wrapper .app-table tbody td {
  border-color: var(--custom-border) !important;
  background-color: var(--custom-bg-card) !important;
  color: var(--custom-text) !important;
  padding: 0.5rem 0.75rem !important;
}

[data-theme="light"] .custom-form-wrapper .custom-subform-table tbody tr:nth-of-type(odd) td,
[data-theme="light"] .custom-form-wrapper .app-table tbody tr:nth-of-type(odd) td {
  background-color: #f9fafb !important;
}

[data-theme="dark"] .custom-form-wrapper .custom-subform-table tbody tr:nth-of-type(odd) td,
[data-theme="dark"] .custom-form-wrapper .app-table tbody tr:nth-of-type(odd) td {
  background-color: #182234 !important;
}

.custom-form-wrapper .badge-custom-highlight {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
}

/* ==========================================================================
   Faithful Line-Oriented Flow & Callout Badges
   ========================================================================== */
.custom-form-wrapper .custom-form-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--custom-border);
  border-radius: 4px;
  transition: background-color 0.15s ease-in-out;
}

.custom-form-wrapper .custom-form-line:hover {
  background-color: rgba(255, 95, 0, 0.04);
}

.custom-form-wrapper .custom-form-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

@media (min-width: 768px) {
  .custom-form-wrapper .custom-form-line {
    flex-wrap: nowrap !important;
  }
}

/* 24-Column Grid System for Custom Forms */
.custom-form-wrapper [class*="col-24-"] {
  min-width: 0 !important;
  padding: 0 0.25rem;
  box-sizing: border-box;
}

.custom-form-wrapper .col-24-1  { flex: 0 0 calc(100% * 1 / 24);  max-width: calc(100% * 1 / 24); }
.custom-form-wrapper .col-24-2  { flex: 0 0 calc(100% * 2 / 24);  max-width: calc(100% * 2 / 24); }
.custom-form-wrapper .col-24-3  { flex: 0 0 calc(100% * 3 / 24);  max-width: calc(100% * 3 / 24); }
.custom-form-wrapper .col-24-4  { flex: 0 0 calc(100% * 4 / 24);  max-width: calc(100% * 4 / 24); }
.custom-form-wrapper .col-24-5  { flex: 0 0 calc(100% * 5 / 24);  max-width: calc(100% * 5 / 24); }
.custom-form-wrapper .col-24-6  { flex: 0 0 calc(100% * 6 / 24);  max-width: calc(100% * 6 / 24); }
.custom-form-wrapper .col-24-7  { flex: 0 0 calc(100% * 7 / 24);  max-width: calc(100% * 7 / 24); }
.custom-form-wrapper .col-24-8  { flex: 0 0 calc(100% * 8 / 24);  max-width: calc(100% * 8 / 24); }
.custom-form-wrapper .col-24-9  { flex: 0 0 calc(100% * 9 / 24);  max-width: calc(100% * 9 / 24); }
.custom-form-wrapper .col-24-10 { flex: 0 0 calc(100% * 10 / 24); max-width: calc(100% * 10 / 24); }
.custom-form-wrapper .col-24-11 { flex: 0 0 calc(100% * 11 / 24); max-width: calc(100% * 11 / 24); }
.custom-form-wrapper .col-24-12 { flex: 0 0 calc(100% * 12 / 24); max-width: calc(100% * 12 / 24); }
.custom-form-wrapper .col-24-13 { flex: 0 0 calc(100% * 13 / 24); max-width: calc(100% * 13 / 24); }
.custom-form-wrapper .col-24-14 { flex: 0 0 calc(100% * 14 / 24); max-width: calc(100% * 14 / 24); }
.custom-form-wrapper .col-24-15 { flex: 0 0 calc(100% * 15 / 24); max-width: calc(100% * 15 / 24); }
.custom-form-wrapper .col-24-16 { flex: 0 0 calc(100% * 16 / 24); max-width: calc(100% * 16 / 24); }
.custom-form-wrapper .col-24-17 { flex: 0 0 calc(100% * 17 / 24); max-width: calc(100% * 17 / 24); }
.custom-form-wrapper .col-24-18 { flex: 0 0 calc(100% * 18 / 24); max-width: calc(100% * 18 / 24); }
.custom-form-wrapper .col-24-19 { flex: 0 0 calc(100% * 19 / 24); max-width: calc(100% * 19 / 24); }
.custom-form-wrapper .col-24-20 { flex: 0 0 calc(100% * 20 / 24); max-width: calc(100% * 20 / 24); }
.custom-form-wrapper .col-24-21 { flex: 0 0 calc(100% * 21 / 24); max-width: calc(100% * 21 / 24); }
.custom-form-wrapper .col-24-22 { flex: 0 0 calc(100% * 22 / 24); max-width: calc(100% * 22 / 24); }
.custom-form-wrapper .col-24-23 { flex: 0 0 calc(100% * 23 / 24); max-width: calc(100% * 23 / 24); }
.custom-form-wrapper .col-24-24 { flex: 0 0 100%;                  max-width: 100%; }

/* 24-Column Offsets */
.custom-form-wrapper .offset-24-1  { margin-left: calc(100% * 1 / 24) !important; }
.custom-form-wrapper .offset-24-2  { margin-left: calc(100% * 2 / 24) !important; }
.custom-form-wrapper .offset-24-3  { margin-left: calc(100% * 3 / 24) !important; }
.custom-form-wrapper .offset-24-4  { margin-left: calc(100% * 4 / 24) !important; }
.custom-form-wrapper .offset-24-5  { margin-left: calc(100% * 5 / 24) !important; }
.custom-form-wrapper .offset-24-6  { margin-left: calc(100% * 6 / 24) !important; }
.custom-form-wrapper .offset-24-7  { margin-left: calc(100% * 7 / 24) !important; }
.custom-form-wrapper .offset-24-8  { margin-left: calc(100% * 8 / 24) !important; }
.custom-form-wrapper .offset-24-9  { margin-left: calc(100% * 9 / 24) !important; }
.custom-form-wrapper .offset-24-10 { margin-left: calc(100% * 10 / 24) !important; }
.custom-form-wrapper .offset-24-11 { margin-left: calc(100% * 11 / 24) !important; }
.custom-form-wrapper .offset-24-12 { margin-left: calc(100% * 12 / 24) !important; }
.custom-form-wrapper .offset-24-13 { margin-left: calc(100% * 13 / 24) !important; }
.custom-form-wrapper .offset-24-14 { margin-left: calc(100% * 14 / 24) !important; }
.custom-form-wrapper .offset-24-15 { margin-left: calc(100% * 15 / 24) !important; }
.custom-form-wrapper .offset-24-16 { margin-left: calc(100% * 16 / 24) !important; }
.custom-form-wrapper .offset-24-17 { margin-left: calc(100% * 17 / 24) !important; }
.custom-form-wrapper .offset-24-18 { margin-left: calc(100% * 18 / 24) !important; }
.custom-form-wrapper .offset-24-19 { margin-left: calc(100% * 19 / 24) !important; }
.custom-form-wrapper .offset-24-20 { margin-left: calc(100% * 20 / 24) !important; }
.custom-form-wrapper .offset-24-21 { margin-left: calc(100% * 21 / 24) !important; }
.custom-form-wrapper .offset-24-22 { margin-left: calc(100% * 22 / 24) !important; }
.custom-form-wrapper .offset-24-23 { margin-left: calc(100% * 23 / 24) !important; }

@media (max-width: 767.98px) {
  .custom-form-wrapper [class*="col-24-"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 0.25rem;
  }
  .custom-form-wrapper [class*="offset-24-"] {
    margin-left: 0 !important;
  }
}

.custom-form-wrapper .custom-line-annotation {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8125rem;
  color: var(--custom-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0.25rem;
}

.custom-form-wrapper .custom-form-line--table-header {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  color: var(--custom-text-muted);
  border-bottom: 1px solid var(--custom-border);
  padding-bottom: 0.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

[data-theme="dark"] .custom-form-wrapper .custom-form-line--table-header {
  color: #94a3b8;
  border-color: #334155;
}

.custom-form-wrapper .custom-line-field-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0 !important;
}

.custom-form-wrapper .custom-line-prompt {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8125rem;
  color: var(--custom-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.custom-form-wrapper .custom-line-prompt .prompt-code {
  color: var(--custom-text-muted);
  font-weight: bold;
  margin-right: 0.35rem;
}

.custom-form-wrapper .custom-line-prompt .prompt-text {
  color: var(--custom-text);
  font-weight: 500;
}

.custom-form-wrapper .custom-line-control {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-grow: 1;
  min-width: 0 !important;
}

.custom-form-wrapper .custom-line-control input.form-control-sm,
.custom-form-wrapper .custom-line-control select.form-select-sm {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  padding: 0.15rem 0.4rem !important;
  height: calc(1.5em + 0.4rem) !important;
  font-size: 0.8125rem !important;
}

/* Plaintext / Text Info Fields (matching DOS colored text on black screen) */
.custom-form-wrapper .custom-field-plaintext {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 0.15rem !important;
  height: calc(1.5em + 0.4rem) !important;
  line-height: calc(1.5em + 0.4rem) !important;
  font-family: Consolas, "Courier New", monospace !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  user-select: text;
  color: var(--custom-text);
  min-width: 0 !important;
  cursor: default;
}

.custom-form-wrapper .custom-field-plaintext--h6 {
  color: #00b4d8 !important; /* Cyan like DOS h6 */
}

.custom-form-wrapper .custom-field-plaintext--h7 {
  color: #ef4444 !important; /* Red like DOS h7 */
}

.custom-form-wrapper .custom-field-plaintext--h3 {
  color: #eab308 !important; /* Yellow like DOS h3 */
}

.custom-form-wrapper .custom-field-plaintext--numeric,
.custom-form-wrapper .custom-field-plaintext.text-end {
  text-align: right !important;
}

/* Numeric right-adjustment: pushes the input to the right edge of its column */
.custom-form-wrapper .custom-line-control.custom-control-numeric {
  justify-content: flex-end;
  text-align: right;
  margin-left: auto;
}

.custom-form-wrapper .custom-line-control.custom-control-numeric input {
  text-align: right;
}

/* Compound controls: hooked fields side-by-side */
.custom-form-wrapper .custom-line-control.custom-compound-control {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  width: 100%;
}

.custom-form-wrapper .custom-line-control.custom-compound-control input,
.custom-form-wrapper .custom-line-control.custom-compound-control select {
  flex: 1 1 auto;
  min-width: 0 !important;
}

/* Compact controls: short inputs don't stretch */
.custom-form-wrapper .custom-line-control.custom-compound-control input.custom-field--compact,
.custom-form-wrapper .custom-line-control.custom-compound-control select.custom-field--compact,
.custom-form-wrapper input.custom-field--compact,
.custom-form-wrapper select.custom-field--compact {
  flex: 0 0 auto !important;
  width: auto !important;
}

.custom-form-wrapper .custom-line-control.custom-compound-control input.custom-field-plaintext {
  flex: 1 1 auto;
  width: auto !important;
}

/* Green highlight (h8) - e.g. Acquirer Code */
.custom-form-wrapper .custom-field--h8 {
  border-color: #22c55e !important;
  color: #15803d !important;
  font-weight: 600 !important;
}
[data-theme="dark"] .custom-form-wrapper .custom-field--h8 {
  border-color: #22c55e !important;
  color: #86efac !important;
  background-color: rgba(34, 197, 94, 0.1) !important;
}

.custom-form-wrapper .custom-date-input {
  min-width: 14ch !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  letter-spacing: 0.02em;
}

.custom-form-wrapper .custom-line-suffix,
.custom-line-suffix {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8125rem;
  color: var(--custom-text-info, #0284c7);
  margin-left: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

[data-theme="dark"] .custom-form-wrapper .custom-line-suffix,
[data-theme="dark"] .custom-line-suffix {
  color: #38bdf8;
}

.custom-form-wrapper .custom-line-header,
.custom-line-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.35rem;
  background: var(--custom-bg-header);
  border: 1px solid var(--custom-border);
  border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  color: var(--custom-text);
  letter-spacing: 0.03em;
}

[data-theme="dark"] .custom-form-wrapper .custom-line-header,
[data-theme="dark"] .custom-line-header {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  color: #e2e8f0;
}

.custom-form-wrapper .custom-callout-badge,
.custom-callout-badge {
  background-color: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fcd34d !important;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .custom-form-wrapper .custom-callout-badge,
[data-theme="dark"] .custom-callout-badge {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

/* ==========================================================================
   Search Mode Unlocked Fields
   ========================================================================== */
.custom-form-wrapper .unlocked-for-search,
.modern-form-wrapper .unlocked-for-search {
  opacity: 1 !important;
  cursor: text !important;
}

.custom-form-wrapper .unlocked-for-search {
  color: #f8fafc !important;
  border-color: #38bdf8 !important;
  border-style: dashed !important;
}

.custom-form-wrapper .unlocked-for-search:focus {
  border-style: solid !important;
  border-color: var(--custom-brand) !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

.modern-form-wrapper .unlocked-for-search {
  background-color: #ffffff !important;
  border-color: #0d6efd !important;
  border-style: dashed !important;
}

/* ==========================================================================
   Quick Report Wizard & Selection Styles
   ========================================================================== */
.quickreport-wizard-bar {
  border-left: 4px solid var(--custom-brand, #ff5a36) !important;
}

.qr-field-selected {
  background-color: #eff6ff !important;
  border-color: #3b82f6 !important;
  border-width: 2px !important;
  border-style: solid !important;
  color: #1d4ed8 !important;
  font-weight: bold !important;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3) !important;
}

[data-theme="dark"] .qr-field-selected {
  background-color: #1e1b4b !important;
  border-color: #f59e0b !important;
  border-width: 2px !important;
  border-style: solid !important;
  color: #fef08a !important;
  font-weight: bold !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4) !important;
}

.qr-dest-card {
  transition: all 0.2s ease-in-out;
}

.qr-dest-card:hover {
  border-color: #38bdf8 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2) !important;
}

.bg-purple {
  background-color: #7c3aed !important;
}

.quickreport-rendered-view {
  font-family: Consolas, "Courier New", monospace;
}

.quickreport-rendered-view .table {
  font-size: 0.85rem;
}

@media print {
  body * {
    visibility: hidden;
  }
  .quickreport-rendered-view, .quickreport-rendered-view * {
    visibility: visible;
  }
  .quickreport-rendered-view {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
  }
  .quickreport-rendered-view .table {
    color: #000 !important;
  }
  .quickreport-rendered-view .table-dark {
    background: transparent !important;
    color: #000 !important;
  }
  .quickreport-rendered-view th, .quickreport-rendered-view td {
    border-color: #ccc !important;
  }
}

#qrEditorDqlContainer .cm-editor,
#qrEditorTemplateContainer .cm-editor {
  height: 250px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.qr-query-tray,
.qr-columns-tray {
  border-left: 4px solid #38bdf8 !important;
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .qr-query-tray,
[data-theme="dark"] .qr-columns-tray {
  background-color: #0f172a !important;
  border-color: #334155;
  color: #f8fafc;
}

.qr-fake-option:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   80-Column Grid Line Engine for Custom View (Vertical Alignment)
   ========================================================================== */
.custom-form-wrapper .custom-form-grid-line,
.custom-form-grid-line {
  display: grid !important;
  grid-template-columns: repeat(80, minmax(0, 1fr)) !important;
  column-gap: 2px !important;
  align-items: center !important;
  min-height: 30px;
  margin-bottom: 0.25rem;
  width: 100%;
}

.custom-form-wrapper .custom-form-grid-line > * {
  min-width: 0 !important;
}

.custom-form-wrapper .custom-line-prompt {
  font-size: 0.8125rem;
  color: var(--custom-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  line-height: 1.2;
  margin-bottom: 0;
}

.custom-form-wrapper .custom-table-header-cell {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--custom-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.custom-form-wrapper .custom-line-control {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.custom-form-wrapper .custom-line-control input,
.custom-form-wrapper .custom-line-control select {
  width: 100%;
  min-width: 0;
}

.custom-form-wrapper .custom-line-control.custom-control-numeric {
  justify-content: flex-end;
}

.custom-form-wrapper .custom-line-control.custom-control-numeric input {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.custom-form-wrapper .custom-line-control.custom-compound-control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.custom-form-wrapper .custom-line-control.custom-compound-control input.custom-field--compact {
  flex: 0 0 auto !important;
  width: auto !important;
}

@media (max-width: 767.98px) {
  .custom-form-wrapper .custom-form-grid-line,
  .custom-form-grid-line {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
    margin-bottom: 0.75rem !important;
  }
  .custom-form-wrapper .custom-form-grid-line > *,
  .custom-form-grid-line > * {
    grid-column: auto !important;
    width: 100% !important;
  }
}

