/* ==========================================================================
   SSO controls that replace DevExpress ones INS.UI has no counterpart for.

   AppFormLayout (Components/FormLayout) — replacement for DevExpress
   DxFormLayout, laid out like DxFormLayout 24.2 with the Fluent theme
   (measured on the DevExpress build of this app, .dx-evidence/W0b/dom):
     - 12-column rows with a 24px gutter (row margin -12px, column padding 12px);
     - group: 8px vertical margin, header 44px (12px 16px padding, 14px/600),
       body padding 8px 16px 16px;
     - item: 12px top margin, caption left of the control (14px/20px bold,
       padding 6px 16px 6px 0, width = widest caption of the group, set by
       js/app-form-layout.js), control fills the rest.
   ========================================================================== */
.app-fl {
    display: block;
    margin-top: -12px; /* DxFormLayout sits 12px into its container's top padding */
    font-size: 14px;
    line-height: 20px;
}

.app-fl-row {
    display: flex;
    flex-wrap: wrap;
    margin: -12px -12px 0;
}

/* the layout's own row starts at the top of the layout (DxFormLayout) */
.app-fl > .app-fl-row {
    margin-top: 0;
}

.app-fl-col {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
}

@media (min-width: 768px) {
    .app-fl-col-md-1 { width: 8.333333%; }
    .app-fl-col-md-2 { width: 16.666667%; }
    .app-fl-col-md-3 { width: 25%; }
    .app-fl-col-md-4 { width: 33.333333%; }
    .app-fl-col-md-5 { width: 41.666667%; }
    .app-fl-col-md-6 { width: 50%; }
    .app-fl-col-md-7 { width: 58.333333%; }
    .app-fl-col-md-8 { width: 66.666667%; }
    .app-fl-col-md-9 { width: 75%; }
    .app-fl-col-md-10 { width: 83.333333%; }
    .app-fl-col-md-11 { width: 91.666667%; }
    .app-fl-col-md-12 { width: 100%; }
}

.app-fl-group {
    margin: 8px 0;
}

.app-fl-group-box {
    display: flex;
    flex-direction: column;
    border-radius: 4px;
}

.app-fl-group-header {
    display: flex;
    padding: 12px 16px;
    border-radius: 4px;
    font-weight: 600;
}

.app-fl-group-caption {
    flex: 1 1 auto;
}

.app-fl-group-body {
    padding: 8px 16px 16px;
}

.app-fl-item {
    display: flex;
    align-items: flex-start;
    margin-top: 12px;
}

.app-fl-caption {
    display: flex;
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 16px 6px 0;
    font-weight: 700;
    line-height: 20px;
}

.app-fl-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* ==========================================================================
   AppTabs (Components/Tabs) — replacement for DevExpress DxTabs, Fluent
   geometry: 50px strip (3px padding), 44px tabs with 10px 16px padding and
   14px text, the active tab semibold with a 3px accent under it.
   ========================================================================== */
.app-tabs {
    display: block;
    font-size: 16px;
    line-height: 1.5; /* unitless, as DxTabs: content keeps its own line height (pre: 21px) */
}

.app-tabs-list {
    display: flex;
    margin: 0;
    padding: 3px;
    list-style: none;
}

.app-tabs-item {
    display: flex;
}

/* DxTabs' content panel is a flex box: the margins of the first/last child stay inside it */
.app-tabs-content {
    display: flow-root;
}

.app-tab {
    position: relative;
    height: 44px;
    padding: 10px 20px; /* DxTabs: 16px item padding + 4px around the caption */
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--ins-ui-text-secondary);
    font-size: 14px;
    line-height: 24px;
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
}

.app-tab:hover {
    background-color: var(--ins-ui-hover-bg);
    color: var(--ins-ui-text);
}

.app-tab.active {
    color: var(--ins-ui-text);
    font-weight: 600;
}

.app-tab.active::after {
    content: "";
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 0;
    height: 3px;
    border-radius: 2px;
    background-color: var(--ins-ui-primary);
}

.app-tab:focus-visible {
    outline: 2px solid var(--ins-ui-primary);
    outline-offset: -2px;
}

/* ==========================================================================
   AppToastHost (Components/Toast) — replacement for DevExpress
   DxToastProvider, laid out like the Fluent toast (top-right of the page,
   16px margin, 4px accent line, body padding 14px 10px 14px 8px, 16px icon,
   16px/22px semibold title, 14px/20px text, 24px close button).
   ========================================================================== */
.app-toast-portal {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2100;
    max-width: 100%;
    font-size: 16px;
    line-height: 24px;
    pointer-events: none;
}

.app-toast {
    display: flex;
    margin: 16px;
    border-radius: 4px;
    background-color: var(--ins-ui-text);
    color: color-mix(in srgb, var(--ins-ui-surface) 78%, transparent);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .24);
    pointer-events: auto;
    animation: app-toast-in .25s ease-out;
}

@keyframes app-toast-in {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: none; }
}

.app-toast-accent {
    flex: 0 0 4px;
    border-radius: 4px 0 0 4px;
    background-color: var(--ins-ui-info);
}

.app-toast-success .app-toast-accent { background-color: var(--ins-ui-success); }
.app-toast-warning .app-toast-accent { background-color: var(--ins-ui-warning-border); }
.app-toast-danger .app-toast-accent { background-color: var(--ins-ui-danger-text); }

.app-toast-body {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    padding: 14px 10px 14px 8px;
}

.app-toast-icon-column {
    flex: 0 0 16px;
    padding-top: 2px;
}

.app-toast-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 16px;
}

.app-toast-content {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
}

.app-toast-text-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
}

.app-toast-header {
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
    color: var(--ins-ui-surface);
}

.app-toast-text {
    font-size: 14px;
    line-height: 20px;
    overflow-wrap: anywhere;
}

.app-toast-close {
    flex: 0 0 24px;
}

.app-toast-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--ins-ui-surface);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.app-toast-close-btn:hover {
    background-color: color-mix(in srgb, var(--ins-ui-surface) 12%, transparent);
}

/* ==========================================================================
   Accordion of Components/ComponentIntegrationGuide (was DxAccordion):
   native <details> items.
   ========================================================================== */
.app-accordion-item {
    border: 1px solid var(--ins-ui-border-subtle);
    border-radius: 4px;
    margin-bottom: 8px;
}

.app-accordion-header {
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}

.app-accordion-body {
    padding: 0 16px 16px;
}