/* =============================================================================
   data-import-status.css — "Data Import Status" accordion
   -----------------------------------------------------------------------------
   Inserted above the Development_ListView grid.

   Theming: every colour resolves through the --app-* tokens defined in
   theme-bridge.css, which chain --bs-* (classic DX themes) -> --dxds-* (Fluent)
   -> literal fallback. The panel therefore follows the user's selected theme in
   light and dark without a theme-specific rule here. Do NOT introduce raw hex
   colours below.

   font-family is deliberately omitted so the panel inherits the active theme's
   body font, matching leaseup-compliance.css.
   ============================================================================= */

.dis {
    --dis-gutter: 14px;

    box-sizing: border-box;
    margin: 8px 0 12px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    background: var(--app-surface);
    color: var(--app-fg);
    overflow: hidden;
}

.dis *,
.dis *::before,
.dis *::after {
    box-sizing: inherit;
}

/* ---- header bar ---------------------------------------------------------- */

.dis__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px var(--dis-gutter);
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s ease;
}

.dis__bar:hover {
    background: var(--app-surface-soft);
}

.dis__bar:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: -2px;
}

.dis__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
    color: var(--app-muted);
    transition: transform .15s ease;
}

.dis__bar.is-open .dis__chevron {
    transform: rotate(90deg);
}

.dis__bar-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;   /* lets long file names ellipsize instead of widening the bar */
    flex: 1 1 auto;
}

.dis__title {
    font-weight: 600;
    line-height: 1.2;
}

.dis__subtitle {
    color: var(--app-muted);
    font-size: .82em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dis__bar-kpis {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---- status chips -------------------------------------------------------- */

.dis__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface-soft);
    font-size: .78em;
    line-height: 1.5;
    white-space: nowrap;
}

/* Queued and Processing both read as "in flight"; Processing is the stronger tint
   so a glance distinguishes waiting from working. */
.dis__chip--queued {
    background: var(--app-warning-soft);
    border-color: var(--app-warning-border);
    color: var(--app-warning);
}

.dis__chip--processing {
    background: var(--app-primary-soft);
    border-color: var(--app-primary-border);
    color: var(--app-primary);
}

.dis__chip--processed {
    background: var(--app-success-soft);
    border-color: var(--app-success-border);
    color: var(--app-success);
}

.dis__chip--failed {
    background: var(--app-danger-soft);
    border-color: var(--app-danger-border);
    color: var(--app-danger);
}

/* ---- panel --------------------------------------------------------------- */

.dis__panel {
    padding: 0 var(--dis-gutter) var(--dis-gutter);
    border-top: 1px solid var(--app-border);
}

.dis__state {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
    color: var(--app-muted);
    font-size: .88em;
}

.dis__state--error {
    color: var(--app-danger);
}

.dis__note {
    padding: 8px 0 0;
    color: var(--app-warning);
    font-size: .84em;
}

.dis__spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--app-border);
    border-top-color: var(--app-primary);
    border-radius: 50%;
    animation: dis-spin .7s linear infinite;
}

@keyframes dis-spin {
    to { transform: rotate(360deg); }
}

/* Respect a reduced-motion preference: hold the ring still rather than spinning. */
@media (prefers-reduced-motion: reduce) {
    .dis__spinner {
        animation: none;
    }
}

.dis__btn {
    padding: 3px 10px;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .85em;
    cursor: pointer;
}

.dis__btn:hover {
    background: var(--app-surface-hover);
}

.dis__btn:disabled {
    opacity: .6;
    cursor: default;
}

/* Re-Initiate sits inline in the run header, so it needs its own emphasis to read as an action
   rather than as another metadata chip. */
.dis__btn--requeue {
    margin-left: auto;
    border-color: var(--app-primary-border);
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-weight: 600;
}

.dis__btn--requeue:hover:not(:disabled) {
    background: var(--app-primary-soft-strong);
}

/* ---- latest run ---------------------------------------------------------- */

.dis__run {
    padding-top: 12px;
}

.dis__run-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dis__file {
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: .9em;
}

.dis__meta {
    color: var(--app-muted);
    font-size: .8em;
}

/* auto-fit keeps the cells evenly sized whether six or eight are rendered */
.dis__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.dis__cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 11px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

/* Created / updated are the two numbers the panel exists to show. */
.dis__cell--accent {
    background: var(--app-primary-soft);
    border-color: var(--app-primary-border);
}

.dis__cell-value {
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1.1;
}

.dis__cell-label {
    color: var(--app-muted);
    font-size: .76em;
}

/* Marks a chip that reports an INSERT rather than an update — the thing a manager scanning the
   collapsed bar is most likely to be looking for. */
.dis__chip--created {
    background: var(--app-success-soft);
    border-color: var(--app-success-border);
    color: var(--app-success);
}

/* ---- newly created records ----------------------------------------------- */

.dis__created {
    margin-top: 16px;
}

/* auto-fit so one populated group fills the width and three sit side by side */
.dis__created-group {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--app-success-border);
    border-radius: 8px;
    background: var(--app-success-soft);
}

.dis__created-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: .82em;
    font-weight: 600;
    color: var(--app-success);
}

.dis__created-count {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--app-surface);
    border: 1px solid var(--app-success-border);
    font-size: .95em;
    font-weight: 700;
}

.dis__created-list {
    /* Two columns on wide panels so fifty unit numbers do not become a long thin ribbon. */
    columns: 2;
    column-gap: 18px;
    margin: 0;
    padding-left: 18px;
    font-size: .84em;
}

.dis__created-list li {
    break-inside: avoid;
    margin-bottom: 2px;
}

.dis__created-label {
    font-weight: 600;
}

.dis__created-detail {
    color: var(--app-muted);
}

.dis__created-detail::before {
    content: " · ";
}

.dis__created-more {
    color: var(--app-muted);
    font-style: italic;
    list-style: none;
    margin-left: -18px;
}

@media (max-width: 720px) {
    .dis__created-list {
        columns: 1;
    }
}

/* ---- history ------------------------------------------------------------- */

.dis__history {
    margin-top: 16px;
}

.dis__history-title {
    margin-bottom: 6px;
    color: var(--app-muted);
    font-size: .8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dis__table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84em;
}

.dis__table th,
.dis__table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
    vertical-align: middle;
}

.dis__table th {
    color: var(--app-muted);
    font-weight: 600;
}

.dis__table tr:last-child td {
    border-bottom: 0;
}

.dis__num {
    text-align: right;
}

/* Stack the bar on narrow viewports so the chips do not squeeze the title. */
@media (max-width: 720px) {
    .dis__bar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .dis__bar-kpis {
        justify-content: flex-start;
        width: 100%;
        padding-left: 26px;
    }

    .dis__file {
        max-width: 100%;
    }
}
