/**
 * DevExtreme generic theme sets Helvetica on .dx-widget and all descendants.
 * This file MUST load after dx.light.css / dx.dark.css (see index.html link order).
 * Kappa typography handoff: Sans on widgets; Mono on amounts/codes (TYPOGRAPHY.md).
 */

html.kappa-theme-light,
html.kappa-theme-dark,
html.kappa-theme-light body,
html.kappa-theme-dark body,
html.kappa-theme-light .dx-widget,
html.kappa-theme-dark .dx-widget,
html.kappa-theme-light .dx-widget *,
html.kappa-theme-dark .dx-widget *,
html.kappa-theme-light .dx-overlay-wrapper,
html.kappa-theme-dark .dx-overlay-wrapper,
html.kappa-theme-light .dx-overlay-wrapper *,
html.kappa-theme-dark .dx-overlay-wrapper * {
  font-family: var(--kappa-font-sans) !important;
  font-size: 13px;
}

/* Form top-labels — handoff 11.5px/600; beats `.dx-overlay-wrapper *` / `.dx-widget *` { 13px }. */
html.kappa-theme-light .dx-overlay-wrapper .kappa-form-field__label,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-form-field__label,
html.kappa-theme-light .dx-widget .kappa-form-field__label,
html.kappa-theme-dark .dx-widget .kappa-form-field__label {
  font-size: var(--kappa-form-label-size, 11.5px);
  font-weight: var(--kappa-form-label-weight, 600);
  letter-spacing: 0.1px;
  line-height: 1.3;
  color: var(--kappa-text-secondary);
}

/* Dialog title ✕ — handoff 26×26 box, ~16px glyph (not dialog body 13px). */
html.kappa-theme-light .dx-overlay-wrapper .kappa-dialog__close-btn,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-dialog__close-btn,
html.kappa-theme-light .dx-overlay-wrapper .kappa-dialog__close-btn span,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-dialog__close-btn span {
  font-size: 16px;
  line-height: 1;
}

/* Dialog title bar — handoff Journal entry dialog (15px/700 + 12px context); beats `.dx-overlay-wrapper * { 13px }`. */
html.kappa-theme-light .dx-overlay-wrapper .kappa-dialog__title-text,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-dialog__title-text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--kappa-text-heading);
}

html.kappa-theme-light .dx-overlay-wrapper .kappa-dialog__subtitle,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-dialog__subtitle {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--kappa-text-muted);
}

html.kappa-theme-light .dx-overlay-wrapper .kappa-column-chooser__close-btn,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-column-chooser__close-btn,
html.kappa-theme-light .dx-overlay-wrapper .kappa-column-chooser__close-btn span,
html.kappa-theme-dark .dx-overlay-wrapper .kappa-column-chooser__close-btn span {
  font-size: 14px;
  line-height: 1;
}

html.kappa-theme-light .dx-widget input:not(.kappa-form-input--number):not(.kappa-validation-lookup__code-input),
html.kappa-theme-light .dx-widget textarea,
html.kappa-theme-dark .dx-widget input:not(.kappa-form-input--number):not(.kappa-validation-lookup__code-input),
html.kappa-theme-dark .dx-widget textarea,
html.kappa-theme-light .dx-overlay-wrapper input:not(.kappa-form-input--number):not(.kappa-validation-lookup__code-input),
html.kappa-theme-light .dx-overlay-wrapper textarea,
html.kappa-theme-dark .dx-overlay-wrapper input:not(.kappa-form-input--number):not(.kappa-validation-lookup__code-input),
html.kappa-theme-dark .dx-overlay-wrapper textarea {
  font-family: var(--kappa-font-sans) !important;
}

/*
 * Mono must beat `.dx-widget * { sans !important }` on nested grid text and dialog inputs.
 * See kappa-*-web/docs/design/TYPOGRAPHY.md
 */
.kappa-num,
html.kappa-theme-light .dx-numberbox .dx-texteditor-input,
html.kappa-theme-dark .dx-numberbox .dx-texteditor-input,
html.kappa-theme-light .kappa-form input.kappa-form-input--number,
html.kappa-theme-dark .kappa-form input.kappa-form-input--number,
html.kappa-theme-light .dx-widget input.kappa-form-input--number,
html.kappa-theme-dark .dx-widget input.kappa-form-input--number,
html.kappa-theme-light .dx-overlay-wrapper input.kappa-form-input--number,
html.kappa-theme-dark .dx-overlay-wrapper input.kappa-form-input--number,
html.kappa-theme-light .kappa-validation-lookup__code-input,
html.kappa-theme-dark .kappa-validation-lookup__code-input,
html.kappa-theme-light .kappa-validation-lookup-panel__grid-head > div[data-align='right'],
html.kappa-theme-dark .kappa-validation-lookup-panel__grid-head > div[data-align='right'],
html.kappa-theme-light
  .kappa-validation-lookup-panel__grid-row > div.kappa-validation-lookup-panel__grid-cell--emphasized,
html.kappa-theme-dark
  .kappa-validation-lookup-panel__grid-row > div.kappa-validation-lookup-panel__grid-cell--emphasized,
html.kappa-theme-light .kappa-validation-lookup-panel__grid-row > div[data-align='right'],
html.kappa-theme-dark .kappa-validation-lookup-panel__grid-row > div[data-align='right'],
html.kappa-theme-light .kappa-grid td.kappa-col-amount,
html.kappa-theme-dark .kappa-grid td.kappa-col-amount,
html.kappa-theme-light .kappa-grid td.kappa-col-amount *,
html.kappa-theme-dark .kappa-grid td.kappa-col-amount *,
html.kappa-theme-light .kappa-grid td.kappa-col-code,
html.kappa-theme-dark .kappa-grid td.kappa-col-code,
html.kappa-theme-light .kappa-grid td.kappa-col-code *,
html.kappa-theme-dark .kappa-grid td.kappa-col-code *,
html.kappa-theme-light .kappa-grid td.dx-numeric-column,
html.kappa-theme-dark .kappa-grid td.dx-numeric-column,
html.kappa-theme-light .kappa-grid td.dx-numeric-column *,
html.kappa-theme-dark .kappa-grid td.dx-numeric-column *,
html.kappa-theme-light .kappa-grid td.dx-number-column,
html.kappa-theme-dark .kappa-grid td.dx-number-column,
html.kappa-theme-light .kappa-grid td.dx-number-column *,
html.kappa-theme-dark .kappa-grid td.dx-number-column * {
  font-family: var(--kappa-font-mono) !important;
  font-variant-numeric: tabular-nums;
}

html.kappa-theme-light
  .kappa-validation-lookup__dropdown-collapsed--empty-chip
  .kappa-validation-lookup__code-input,
html.kappa-theme-dark
  .kappa-validation-lookup__dropdown-collapsed--empty-chip
  .kappa-validation-lookup__code-input {
  font-family: var(--kappa-font-sans) !important;
  font-weight: 400;
}

html.kappa-theme-light .dx-numberbox .dx-texteditor-input,
html.kappa-theme-dark .dx-numberbox .dx-texteditor-input,
html.kappa-theme-light .kappa-form input.kappa-form-input--number,
html.kappa-theme-dark .kappa-form input.kappa-form-input--number,
html.kappa-theme-light .kappa-grid td.kappa-col-amount,
html.kappa-theme-dark .kappa-grid td.kappa-col-amount,
html.kappa-theme-light .kappa-grid td.dx-numeric-column,
html.kappa-theme-dark .kappa-grid td.dx-numeric-column,
html.kappa-theme-light .kappa-grid td.dx-number-column,
html.kappa-theme-dark .kappa-grid td.dx-number-column,
html.kappa-theme-light .kappa-validation-lookup-panel__grid-row > div[data-align='right'],
html.kappa-theme-dark .kappa-validation-lookup-panel__grid-row > div[data-align='right'] {
  text-align: right;
}

/* Dates — Sans, column-aligned digits */
html.kappa-theme-light .dx-datebox .dx-texteditor-input,
html.kappa-theme-dark .dx-datebox .dx-texteditor-input,
html.kappa-theme-light .kappa-grid td.kappa-col-date,
html.kappa-theme-dark .kappa-grid td.kappa-col-date,
html.kappa-theme-light .kappa-grid td.kappa-col-date *,
html.kappa-theme-dark .kappa-grid td.kappa-col-date * {
  font-family: var(--kappa-font-sans) !important;
  font-variant-numeric: tabular-nums;
}

/* DevExtreme glyphs (close, sort arrows, dropdown chevrons, checkbox ticks, …) require DXIcons, not IBM Plex. */
html.kappa-theme-light .dx-widget .dx-icon,
html.kappa-theme-dark .dx-widget .dx-icon,
html.kappa-theme-light .dx-overlay-wrapper .dx-icon,
html.kappa-theme-dark .dx-overlay-wrapper .dx-icon,
html.kappa-theme-light .dx-widget .dx-dropdowneditor-icon,
html.kappa-theme-dark .dx-widget .dx-dropdowneditor-icon,
html.kappa-theme-light .dx-overlay-wrapper .dx-dropdowneditor-icon,
html.kappa-theme-dark .dx-overlay-wrapper .dx-dropdowneditor-icon,
html.kappa-theme-light .dx-widget .dx-checkbox-icon,
html.kappa-theme-dark .dx-widget .dx-checkbox-icon,
html.kappa-theme-light .dx-overlay-wrapper .dx-checkbox-icon,
html.kappa-theme-dark .dx-overlay-wrapper .dx-checkbox-icon {
  font-family: DXIcons !important;
  font-style: normal;
  font-weight: normal;
}

.kappa-dialog__wrapper .dx-overlay-content {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: 10px;
  border: 1px solid var(--kappa-panel-border);
  background: var(--kappa-panel-bg);
  box-shadow: 0 16px 48px rgba(18, 36, 66, 0.18);
}

.kappa-theme-dark .kappa-dialog__wrapper .dx-overlay-content {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.kappa-dialog__wrapper .dx-popup-title {
  flex: 0 0 auto;
  padding: 0;
  border-bottom: 1px solid var(--kappa-row-border);
  background: var(--kappa-panel-bg);
}

.kappa-dialog__titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  padding: 12px 18px;
}

.kappa-dialog__title-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--kappa-text-heading);
}

.kappa-dialog__wrapper .dx-popup-title .dx-toolbar-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--kappa-text-heading);
}

.kappa-dialog__wrapper .dx-popup-content {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0% !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 0;
}

.kappa-dialog__wrapper .dx-popup-bottom .dx-toolbar {
  display: none;
}

/* Overlay shader — override DevExtreme dx.light white shader (rgba(255,255,255,.8)) */
.kappa-dialog__wrapper.dx-overlay-wrapper > .dx-overlay-shader {
  background-color: var(--kappa-dialog-overlay) !important;
}

.kappa-theme-dark .dx-overlay-wrapper.kappa-dialog__wrapper > .dx-overlay-shader {
  background-color: var(--kappa-dialog-overlay) !important;
}

/* Editor surfaces — filled controls on panel bg (design handoff) */
.kappa-form .dx-texteditor.dx-editor-outlined,
.kappa-dialog .dx-texteditor.dx-editor-outlined,
.dx-form .dx-texteditor.dx-editor-outlined {
  background: var(--kappa-editor-bg);
}

.kappa-form .dx-texteditor.dx-editor-outlined .dx-texteditor-input,
.kappa-dialog .dx-texteditor.dx-editor-outlined .dx-texteditor-input,
.dx-form .dx-texteditor.dx-editor-outlined .dx-texteditor-input {
  background: transparent;
  color: var(--kappa-text-heading);
}

.kappa-form .dx-texteditor.dx-editor-outlined,
.kappa-dialog .dx-texteditor.dx-editor-outlined,
.dx-form .dx-texteditor.dx-editor-outlined {
  border-color: var(--kappa-editor-border);
  border-radius: var(--kappa-radius-md, 6px);
}

.kappa-form .dx-texteditor.dx-editor-outlined.dx-state-focused,
.kappa-dialog .dx-texteditor.dx-editor-outlined.dx-state-focused,
.dx-form .dx-texteditor.dx-editor-outlined.dx-state-focused {
  border-color: var(--kappa-accent);
  outline: none;
  box-shadow: var(--kappa-editor-focus-shadow);
}

.kappa-form .dx-texteditor.dx-editor-outlined .dx-texteditor-input:focus,
.kappa-dialog .dx-texteditor.dx-editor-outlined .dx-texteditor-input:focus,
.dx-form .dx-texteditor.dx-editor-outlined .dx-texteditor-input:focus {
  outline: none;
}

/* DevExtreme inner focus ring — disabled; accent border on the editor shell (see grid filter row). */
.kappa-form .dx-texteditor.dx-editor-outlined .dx-highlight-outline::after,
.kappa-dialog .dx-texteditor.dx-editor-outlined .dx-highlight-outline::after,
.dx-form .dx-texteditor.dx-editor-outlined .dx-highlight-outline::after {
  border: none !important;
}

/* Trailing editor buttons (dropdown, calendar, clear) — avoid DevExtreme default light fill */
.kappa-form .dx-texteditor-buttons-container .dx-dropdowneditor-button,
.kappa-dialog .dx-texteditor-buttons-container .dx-dropdowneditor-button,
.dx-form .dx-texteditor-buttons-container .dx-dropdowneditor-button,
.kappa-form .dx-texteditor-buttons-container .dx-clear-button-area,
.kappa-dialog .dx-texteditor-buttons-container .dx-clear-button-area,
.dx-form .dx-texteditor-buttons-container .dx-clear-button-area {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.kappa-form .dx-dropdowneditor-button .dx-button-content,
.kappa-dialog .dx-dropdowneditor-button .dx-button-content,
.dx-form .dx-dropdowneditor-button .dx-button-content {
  background: transparent !important;
}

.kappa-form .dx-dropdowneditor-icon,
.kappa-dialog .dx-dropdowneditor-icon,
.dx-form .dx-dropdowneditor-icon {
  color: var(--kappa-text-muted);
}

.kappa-form .dx-dropdowneditor-button.dx-state-hover .dx-dropdowneditor-icon,
.kappa-form .dx-dropdowneditor-button.dx-state-active .dx-dropdowneditor-icon,
.kappa-dialog .dx-dropdowneditor-button.dx-state-hover .dx-dropdowneditor-icon,
.kappa-dialog .dx-dropdowneditor-button.dx-state-active .dx-dropdowneditor-icon,
.dx-form .dx-dropdowneditor-button.dx-state-hover .dx-dropdowneditor-icon,
.dx-form .dx-dropdowneditor-button.dx-state-active .dx-dropdowneditor-icon {
  color: var(--kappa-text-heading);
  background: transparent !important;
}

.kappa-theme-dark .kappa-form .dx-texteditor.dx-editor-outlined .dx-dropdowneditor-button,
.kappa-theme-dark .kappa-dialog .dx-texteditor.dx-editor-outlined .dx-dropdowneditor-button,
.kappa-theme-dark .dx-form .dx-texteditor.dx-editor-outlined .dx-dropdowneditor-button {
  background-color: transparent !important;
}

.kappa-theme-dark .kappa-form .dx-texteditor.dx-editor-outlined .dx-dropdowneditor-button .dx-button-content,
.kappa-theme-dark .kappa-dialog .dx-texteditor.dx-editor-outlined .dx-dropdowneditor-button .dx-button-content,
.kappa-theme-dark .dx-form .dx-texteditor.dx-editor-outlined .dx-dropdowneditor-button .dx-button-content {
  background-color: transparent !important;
}

/* ADR-119 — hide empty DevExtreme invalid-message overlay (out-of-range typed date + calendar). */
.dx-overlay-wrapper .dx-invalid-message .dx-invalid-message-content:empty {
  display: none !important;
}

.dx-overlay-wrapper .dx-invalid-message:has(.dx-invalid-message-content:empty) {
  display: none !important;
  pointer-events: none;
}
