/* ── Error dialog ──
   Global (not scoped) because Syncfusion's modal SfDialog renders outside the component tree.
   Colours come from the Tier-2 --notification-* tokens so the dialog tracks the active theme
   instead of carrying a second hardcoded palette; the neutral greys use the Syncfusion theme's
   own --color-sf-* tokens for the same reason. */

.error-dialog.e-dialog {
    border: 2px solid var(--notification-error-accent, hotpink);
}

/* A TvDialog, but its header band is the error colour, not the brand blue: an error must read as one
   at a glance, even stacked over a blue-banded dialog. Outranks tv-theme's band rule (0,4,0); listed
   for both elements because Syncfusion puts CssClass on the container and on the dialog. The title,
   icon and close icon keep the band's white foreground from tv-theme. */
.e-dlg-container.tv-dialog.error-dialog > .e-dialog > .e-dlg-header-content,
.e-dlg-container.tv-dialog > .e-dialog.error-dialog > .e-dlg-header-content {
    background: var(--notification-error-accent, hotpink);
}

/* The close icon's hover darkens the band it sits on, so on the error band it darkens the error colour. */
.e-dlg-container.tv-dialog.error-dialog > .e-dialog > .e-dlg-header-content .e-dlg-closeicon-btn:hover,
.e-dlg-container.tv-dialog.error-dialog > .e-dialog > .e-dlg-header-content .e-dlg-closeicon-btn:focus-visible,
.e-dlg-container.tv-dialog > .e-dialog.error-dialog > .e-dlg-header-content .e-dlg-closeicon-btn:hover,
.e-dlg-container.tv-dialog > .e-dialog.error-dialog > .e-dlg-header-content .e-dlg-closeicon-btn:focus-visible {
    background: color-mix(in srgb, var(--notification-error-accent, hotpink) 80%, black);
}
/* Syncfusion truncates the title by default; a batched heading and a long single-error title
   both need to wrap. */
.error-dialog .e-dlg-header {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: break-word;
}

/* Sits after the title in TvDialog's header slot, on the band: a step above the title on the type
   ramp, not the badge it was on the old white header. */
.error-dialog-icon.mdi {
    font-size: var(--tv-text-page-title);
    line-height: 1;
}

/* Capped and scrollable: a burst of errors must not grow the modal past the viewport. */
.error-dialog-content {
    font-size: var(--tv-text-body);
    line-height: 1.5;
    max-height: min(60 * var(--tv-vh), 32rem);
    overflow-y: auto;
}

/* Separates the entries when a burst of errors is batched into one dialog. A single error gets
   no rule, so the common case is unchanged. */
.error-dialog-entry + .error-dialog-entry {
    margin-top: var(--tv-space-4);
    padding-top: var(--tv-space-4);
    border-top: 1px solid var(--color-sf-border, #e5e7eb);
}

.error-dialog-message {
    margin-bottom: var(--tv-space-3);
    font-weight: 500;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.error-dialog-count {
    margin-left: 0.375rem;
    font-weight: 400;
    font-size: 0.8rem;
    opacity: 0.75;
}

.error-dialog-pending {
    margin: var(--tv-space-4) 0 0 0;
    padding-top: var(--tv-space-2);
    border-top: 1px solid var(--color-sf-border, #e5e7eb);
    font-size: 0.8rem;
    opacity: 0.85;
}

.error-dialog-validation {
    margin: var(--tv-space-1) 0 var(--tv-space-3) 0;
    padding-left: 1.25rem;
    font-size: 0.85rem;
    color: var(--notification-error-accent, hotpink);
}

.error-dialog-validation li {
    margin-bottom: var(--tv-space-1);
}

.error-dialog-details {
    margin-top: var(--tv-space-3);
    border-top: 1px solid var(--color-sf-border, #e5e7eb);
    padding-top: var(--tv-space-2);
}

.error-dialog-details summary {
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
    user-select: none;
}

.error-dialog-details summary:hover,
.error-dialog-details summary:focus-visible {
    opacity: 1;
}

.error-dialog-details-body {
    margin-top: var(--tv-space-2);
    font-size: 0.8rem;
}

.error-dialog-details-body p {
    margin: var(--tv-space-1) 0;
    word-break: break-word;
}

.error-dialog-details-body code,
.error-dialog-stacktrace {
    font-family: var(--tv-font-mono, monospace);
    background: var(--color-sf-table-bg-color-hover, rgba(127, 127, 127, 0.12));
    border-radius: 3px;
}

.error-dialog-details-body code {
    font-size: var(--tv-text-meta);
    padding: 0.1rem 0.35rem;
}

.error-dialog-stacktrace {
    font-size: 0.7rem;
    max-height: 200px;
    overflow: auto;
    padding: var(--tv-space-2);
    white-space: pre-wrap;
    word-break: break-all;
    margin: var(--tv-space-1) 0 0 0;
    border: 1px solid var(--color-sf-border, #e5e7eb);
}
