/* =============================================================
   Forms — small corrections of the theme
   - Element / attribute selectors only, never hashed CSS-module class
     names: they change on every frontend rebuild.
   ============================================================= */

/* An empty checkbox in the dark theme takes the theme's border color at
   12 % and cannot be told from the form behind it: the «Create
   opportunity» box of the lead conversion looked absent. */
[data-bs-theme="dark"] input[type="checkbox"]:not(:checked) {
  border-color: rgba(234, 234, 255, 0.5);
}

/* A call recording that cannot be played: the form hides the player, and
   the message that stands after it is shown from here — a form template
   can change the element of the event only, not its neighbour. */
audio[style*="display: none"] + div {
  display: block !important;
}

/* «Related to» of an event (css="ref-select-3-9"): the RefSelect keeps its type list at
   200 px and stretches the record search over the rest of the row; here the type takes a
   quarter of the row (3 of 12 columns, like the dates above) and the search the other 9. */
.ref-select-3-9 div[style*="max-width: 200px"] {
  max-width: none !important;
  flex: 0 0 25% !important;
}

/* Amounts line up digit under digit: figures of the same width in the invoice totals
   (css="invoice-amounts" on the field) and in the number columns of every grid — invoice lines
   among them. A grid takes no css class of its own, so the column is matched by the stable part
   of its class name («_number_»), never by its hash; if the frontend renames it the rule just
   stops applying. The columns are already right-aligned by the theme. */
.invoice-amounts,
[class*="_column_"][class*="_number_"] {
  font-variant-numeric: tabular-nums;
}

/* The paperclip of a form (marked by js/oimo-attachments.js): apart from the record menu arrow
   next to it, which holds «Delete» and «Archive», and its file count as a colored badge. */
[data-oimo-attach] {
  margin-right: 8px;
  position: relative;
}
[data-oimo-attach]::after {
  content: "";
  position: absolute;
  top: 20%;
  right: -5px;
  height: 60%;
  border-right: 1px solid rgba(128, 128, 160, 0.45);
}
[data-oimo-attach] > button small {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 8px;
  background: #666cff;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  justify-content: center;
}

/* The attachments window: «Upload a file» as the main action, and a dashed drop zone while the
   folder is empty (js/oimo-attachments.js). */
.oimo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  padding: 4px 12px;
  border: 0;
  border-radius: 6px;
  background: #666cff;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}
.oimo-upload-btn:hover {
  background: #5a5fe0;
}
.oimo-dropzone {
  position: absolute;
  top: 44px;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 2px dashed rgba(102, 108, 255, 0.55);
  border-radius: 10px;
  color: inherit;
  opacity: 0.85;
  text-align: center;
  cursor: pointer;
}
.oimo-dropzone:hover,
.oimo-dropzone:focus,
.oimo-dropzone-over {
  background: rgba(102, 108, 255, 0.08);
  opacity: 1;
  outline: none;
}
.oimo-dropzone-icon,
.oimo-upload-icon {
  font-size: 1.4em;
  line-height: 1;
}
.oimo-dropzone-icon {
  font-size: 2em;
  color: #666cff;
}

/* The icon tabs of a form, as vTiger's (marked by js/oimo-attachments.js, markIconTabs): the
   glyph of the tab's <panel icon="…">, a bootstrap-icons name; the bundle's own bootstrap-icons
   classes are hashed, so the code points are written here. The open tab shows its name, the
   others only the icon — their name is in the dark tooltip (.oimo-tab-tip). */
[data-oimo-icon]::before {
  display: inline-block;
  font-family: bootstrap-icons !important;
  font-size: 15px;
  font-style: normal;
  font-weight: 400 !important;
  line-height: 1;
  vertical-align: -0.125em;
}
[data-oimo-icon="info-circle"]::before { content: "\F431"; }
[data-oimo-icon="person-vcard"]::before { content: "\F8C9"; }
[data-oimo-icon="people"]::before { content: "\F4D0"; }
[data-oimo-icon="credit-card"]::before { content: "\F2DC"; }
[data-oimo-icon="calendar-event"]::before { content: "\F1E8"; }
[data-oimo-icon="telephone"]::before { content: "\F5C1"; }
[data-oimo-icon="briefcase"]::before { content: "\F1CC"; }
[data-oimo-icon="bullseye"]::before { content: "\F1DE"; }
[data-oimo-icon="envelope"]::before { content: "\F32F"; }
[data-oimo-icon="box-seam"]::before { content: "\F1C7"; }
[data-oimo-icon="truck"]::before { content: "\F5EA"; }
[data-oimo-icon="folder2-open"]::before { content: "\F3D8"; }
[data-oimo-icon="file-earmark-text"]::before { content: "\F38B"; }
[data-oimo-icon="life-preserver"]::before { content: "\F467"; }
[data-oimo-icon="file-earmark"]::before { content: "\F392"; }
[data-oimo-icon="cash-stack"]::before { content: "\F246"; }
[data-oimo-icon="receipt"]::before { content: "\F50F"; }
[data-oimo-icon="cash-coin"]::before { content: "\F632"; }
[data-oimo-icon="cart3"]::before { content: "\F244"; }
[data-oimo-icon="tags"]::before { content: "\F5B2"; }
[data-oimo-icon="chat-dots"]::before { content: "\F24A"; }
[data-oimo-icon="file-text"]::before { content: "\F3B9"; }
[data-oimo-icon="calculator"]::before { content: "\F1E0"; }
[data-oimo-icon="diagram-3"]::before { content: "\F2EE"; }
[data-oimo-icon="building"]::before { content: "\F1DD"; }
[data-oimo-icon="clipboard-check"]::before { content: "\F28B"; }
[data-oimo-icon="file-earmark-plus"]::before { content: "\F37D"; }
[data-oimo-icon="gear"]::before { content: "\F3E5"; }
[data-oimo-icon="x-circle"]::before { content: "\F623"; }

[data-oimo-tab-title]:not([class*="_active_"]) [class*="_text_"] {
  display: none;
}
.oimo-tab-tip {
  position: fixed;
  z-index: 9999;
  display: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
  pointer-events: none;
}

/* The raw technical text of a form (css="oimo-raw-json"): the original request of a service
   registration, the exchanges with 1C, PBX and Chat2Desk events, the email import log, error
   traces. JSON one field to a line, in a dark monospace block. Read-only the text widget renders
   a <pre>, in edit mode a <textarea>; the rules are on that inner element. Long lines scroll
   inside the block, the form grid stays. */
.oimo-raw-json pre,
.oimo-raw-json textarea {
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace !important;
  font-size: 12.5px !important;
  line-height: 1.5 !important;
  white-space: pre !important;
  background: #14141e !important;
  color: #93c5fd !important;
  border-radius: 6px !important;
  overflow-x: auto !important;
  padding: 12px 14px !important;
}

/* The year list of the calendars shows ten years; its arrows to the earlier and later years were
   empty links (nothing to see, nothing to click): drawn here, the list moves by a year per click
   (a date of birth is typed faster: 15.03.1990). */
.react-datepicker__year-dropdown .react-datepicker__navigation--years {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 20px !important;
  top: 0 !important;
  text-indent: 0 !important;
  border: 0 !important;
  cursor: pointer;
  color: var(--bs-secondary-color, #9ca3af);
}
.react-datepicker__year-dropdown .react-datepicker__navigation--years:hover {
  color: var(--bs-primary, #666cff);
}
.react-datepicker__navigation--years-upcoming::before {
  content: "\25B2";
  font-size: 10px;
}
.react-datepicker__navigation--years-previous::before {
  content: "\25BC";
  font-size: 10px;
}

/* The «OK» of a popup form, renamed «Сохранить» and marked by js/oimo-attachments.js: green, as
   the save of vTiger, in both themes. Only that button: the OK of the selectors, the
   confirmations and the alerts keeps the theme's color. */
button[data-oimo-modal-save="1"] {
  background-color: #16a34a !important;
  border-color: #16a34a !important;
  color: #ffffff !important;
  font-weight: 600;
}
button[data-oimo-modal-save="1"]:hover,
button[data-oimo-modal-save="1"]:focus-visible {
  background-color: #15803d !important;
  border-color: #15803d !important;
  color: #ffffff !important;
}
button[data-oimo-modal-save="1"]:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.4) !important;
}
button[data-oimo-modal-save="1"]:active {
  background-color: #166534 !important;
  border-color: #166534 !important;
}
button[data-oimo-modal-save="1"]:disabled {
  background-color: #16a34a !important;
  border-color: #16a34a !important;
  color: #ffffff !important;
  opacity: 0.55;
  cursor: not-allowed;
}

/* The project's «MyChat Dialog ID» read (axelor-chat ProjectChat.xml, the field's viewer): the id
   and «Open the dialog» on one line in the field's own 6 columns; the link an outlined, quiet
   button with a soft hover. Edited, the field is the plain input. */
.oimo-dialog-view {
  min-height: 32px;
}
.oimo-dialog-id {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.oimo-dialog-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid rgba(var(--bs-primary-rgb, 102, 108, 255), 0.55);
  border-radius: var(--bs-border-radius, 6px);
  background: transparent;
  color: var(--bs-primary, #666cff);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.oimo-dialog-link:hover,
.oimo-dialog-link:focus-visible {
  background: rgba(var(--bs-primary-rgb, 102, 108, 255), 0.12);
  border-color: var(--bs-primary, #666cff);
  color: var(--bs-primary, #666cff);
  text-decoration: none;
}
.oimo-dialog-link:active {
  background: rgba(var(--bs-primary-rgb, 102, 108, 255), 0.2);
}

/* The project's stages (Project.xml statusPanel, projectStatus with widget NavSelect): edited, the
   widget draws the many-to-one's own select («New» with its open / search icons) above the stages,
   a second copy of the status. Only that select goes; the stages and the transition buttons stay. */
.oimo-status-nav div:has(> div > [role="combobox"]) {
  display: none !important;
}

/* Inline editing of a card (js/oimo-inline-edit.js): in a read-only form the user may edit, a value
   shows it is editable by a click, a label too; the pencil of a hovered cell, for a field whose value
   is a link (phone, email, a related record); the note when the field itself cannot be changed. */
[data-oimo-inline-edit="1"] [class*="_content_"] input[class*="_viewer_"],
[data-oimo-inline-edit="1"] [class*="_content_"] pre {
  cursor: text;
  border-radius: var(--bs-border-radius-sm, 4px);
  transition: background-color 0.12s ease;
}
[data-oimo-inline-edit="1"] [class*="_content_"] input[class*="_viewer_"]:hover,
[data-oimo-inline-edit="1"] [class*="_content_"] pre:hover {
  background-color: rgba(var(--bs-primary-rgb, 102, 108, 255), 0.08) !important;
}
[data-oimo-inline-edit="1"] [class*="_container_"] > [class*="_title_"] label[for] {
  cursor: pointer;
}
.oimo-inline-edit-pencil {
  position: absolute;
  z-index: 1050;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--bs-secondary-color, #9ca3af);
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}
.oimo-inline-edit-pencil[hidden] {
  display: none;
}
.oimo-inline-edit-pencil:hover,
.oimo-inline-edit-pencil:focus-visible {
  background: rgba(var(--bs-primary-rgb, 102, 108, 255), 0.12);
  color: var(--bs-primary, #666cff);
}
.oimo-inline-edit-note {
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--bs-border-radius, 6px);
  background: var(--bs-dark, #212529);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
