/* Content spacing */
.content {
    padding-top: 1.1rem;
}

/* Banners */
.aeo-banner {
    background: var(--brand-action);
    color: #fff;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
}

/* Tables & dividers */
hr, .aeo-divider {
    border-top: 1px solid var(--divider, #e8ecf3);
}

table thead th {
    border-bottom: 2px solid var(--divider, #e8ecf3);
}

table tbody tr + tr td {
    border-top: 1px solid var(--divider, #e8ecf3);
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

/* Error boundary */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Footer */
.aeo-footer {
    background: #1f2937;
    color: #ffffff;
}

.aeo-footer a {
    color: var(--brand-action);
}

/* Progress bar (navigation) */
.aeo-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-action) 0%, var(--brand-action-hover) 50%, var(--brand-action) 100%);
    animation: aeo-progress-sweep 1.2s linear infinite;
    z-index: 9999;
}

@keyframes aeo-progress-sweep {
    0% { background-position: -200vw 0; }
    100% { background-position: 200vw 0; }
}

@media (prefers-reduced-motion: reduce) {
    .aeo-progress { animation: none !important; }
}

/* Shared workspace utility classes */
.aeo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
}
.aeo-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.aeo-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
}
@media (max-width: 900px) {
    .aeo-grid, .aeo-grid-2, .aeo-grid-3 {
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }
}
.workspace-panel-heading,
.workspace-panel-title,
.aeo-card-title,
.chart-header-stack h5 {
    color: var(--section-heading);
    font-family: var(--font-family-heading);
    font-size: var(--font-size-section-title);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
}

.workspace-subsection-title {
    color: var(--section-heading);
    font-family: var(--font-family-heading);
    font-size: var(--font-size-control);
    font-weight: var(--font-weight-semibold);
    line-height: 1.35;
    margin: 0 0 0.35rem;
}

.aeo-chart-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: var(--text-strong);
    color: transparent;
    cursor: help;
    font-size: 0;
    vertical-align: text-bottom;
}

.aeo-chart-info::after {
    color: var(--surface-primary);
    content: "i";
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 700;
}

.workspace-content .aeo-card > h2,
.workspace-content .aeo-panel > h2 {
    color: var(--section-heading);
    font-family: var(--font-family-heading);
    font-size: var(--font-size-section-title);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.workspace-content .aeo-card > h3,
.workspace-content .aeo-panel > h3 {
    color: var(--section-heading);
    font-size: var(--font-size-control);
    font-weight: 700;
}

.workspace-content .aeo-card > h4,
.workspace-content .aeo-panel > h4 {
    color: var(--section-heading);
    font-family: var(--font-family-heading);
    font-size: var(--font-size-section-title);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.workspace-content .aeo-card > h5,
.workspace-content .aeo-panel > h5 {
    color: var(--section-heading);
    font-size: var(--font-size-control);
    font-weight: 700;
    line-height: 1.4;
}

.brand-intelligence-page .bi-section.mt-3 {
    margin-top: var(--space-panel-gap) !important;
}
.text-muted {
    color: var(--text-muted) !important;
}
.aeo-card-subtle {
    font-size: 1.05em;
    margin-bottom: 0.5rem;
}
.aeo-kpi {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.aeo-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 0.75em;
    padding: 0.2em 0.7em;
    font-size: 0.95em;
    font-weight: 500;
    margin-right: 0.5em;
    margin-bottom: 0.2em;
}
.aeo-badge--ok {
    background: #d1fae5;
    color: #065f46;
    border: 1.5px solid #10b981;
    outline: 2px solid #065f46;
}
.aeo-badge--warn {
    background: #fef3c7;
    color: #92400e;
    border: 1.5px solid #f59e42;
    outline: 2px solid #92400e;
}
.aeo-badge--bad {
    background: #fee2e2;
    color: #991b1b;
    border: 1.5px solid #ef4444;
    outline: 2px solid #991b1b;
}
.aeo-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 1.3rem;
    font-weight: 700;
    margin-right: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--aeo-border, #e5e7eb);
}
.aeo-placeholder {
    background: #f8fafc;
    color: #64748b;
    border-radius: 0.5em;
    padding: 0.75em 1em;
    font-size: 1em;
    margin-bottom: 0.5em;
}
.aeo-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.aeo-divider {
    border-top: 1px solid var(--aeo-border, #e5e7eb);
    margin: 1.5rem 0;
}
.aeo-print-break {
    break-inside: avoid;
    break-before: page;
    break-after: page;
}
.aeo-side-nav-section {
    font-size: 0.75rem; /* smaller than links */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
}

.workspace-section-caption {
    font-size: var(--font-size-metadata);
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}

.overview-state-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.overview-state-card__action {
    align-self: flex-start;
    margin-top: auto;
}

/* Shared local workspace navigation used by Prompts and Prompt Insights. */
.workspace-subnav-panel {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-primary);
    box-shadow: var(--shadow-xs);
}

.workspace-subnav-panel__title {
    margin: 0;
    color: var(--section-heading);
    font-size: var(--font-size-section-title);
    font-weight: 700;
}

.workspace-subnav-panel__description {
    margin: 0;
    color: var(--text-body);
    font-size: var(--font-size-body);
}

.workspace-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.workspace-subnav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-control);
    background: var(--surface-primary);
    color: var(--text-body);
    font-size: var(--font-size-metadata);
    font-weight: 600;
    text-decoration: none;
}

.workspace-subnav a:hover,
.workspace-subnav a:focus-visible {
    color: var(--title-accent);
    border-color: var(--title-accent);
    background: var(--surface-primary);
    box-shadow: var(--navigation-halo) !important;
}

.workspace-subnav a.active {
    color: var(--title-accent);
    border-color: rgba(154, 77, 10, 0.38);
    background: var(--title-accent-soft);
    font-weight: 700;
}

.workspace-subnav-panel__back {
    color: var(--text-body);
    font-size: var(--font-size-metadata);
    font-weight: 600;
    text-decoration: none;
}

/* Prompt Insights inventory keeps its domain-specific columns while using
   the shared workflow density, status, and action primitives. */
.prompt-insights-columns {
    display: grid;
    grid-template-columns: minmax(16rem, 1.4fr) repeat(3, minmax(12rem, 1fr));
    gap: var(--space-workflow-gap);
    padding: 0.65rem var(--space-workflow-x);
    border-bottom: 1px solid var(--divider);
    background: var(--surface-secondary);
    color: var(--section-heading);
    font-size: var(--font-size-body);
    font-weight: 700;
}

.prompt-insights-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    padding-bottom: .75rem;
}

.prompt-insights-summary .aeo-chip {
    font-weight: 600;
}

.prompt-insights-columns--focused {
    grid-template-columns: minmax(16rem, 1.4fr) minmax(16rem, 1fr);
}

.prompt-insights-columns__artifact {
    padding-left: 0.75rem;
}

.prompt-insights-row {
    display: grid;
    grid-template-columns: minmax(16rem, 1.4fr) repeat(3, minmax(12rem, 1fr));
    gap: var(--space-workflow-gap);
}

.prompt-insights-row--focused {
    grid-template-columns: minmax(16rem, 1.4fr) minmax(16rem, 1fr);
}

.prompt-insights-prompt {
    min-width: 0;
}

.prompt-insights-angle-chip {
    margin-top: 0.45rem;
}

.prompt-output-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.35rem;
    min-width: 0;
    padding-left: 0.75rem;
    border-left: 3px solid var(--border-strong);
}

.prompt-output-cell__state {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.prompt-output-cell__name {
    display: none;
    color: var(--section-heading);
    font-size: var(--font-size-body);
    font-weight: 700;
}

.prompt-output-cell__date {
    margin-top: 0;
}

.prompt-output-cell__actions {
    margin-top: 0;
    padding-top: 0;
}

@media (min-width: 1350.01px) {
    .prompt-output-cell__state--label-only {
        display: none;
    }
}

.prompt-insights-prompt-autocomplete {
    position: relative;
    min-width: 20rem;
}

.prompt-insights-prompt-autocomplete__input {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--surface-elevated);
}

.prompt-insights-prompt-autocomplete__input input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.75rem;
    border: 0;
    outline: 0;
    background: transparent;
}

.prompt-insights-prompt-autocomplete__clear {
    padding: 0.25rem 0.65rem;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.prompt-insights-prompt-autocomplete__suggestions {
    position: absolute;
    z-index: 20;
    right: 0;
    left: 0;
    margin-top: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-sm);
}

.prompt-insights-prompt-autocomplete__suggestion {
    display: block;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--surface-elevated);
    color: var(--text-strong);
    text-align: left;
}

.prompt-insights-prompt-autocomplete__suggestion:hover,
.prompt-insights-prompt-autocomplete__suggestion:focus {
    background: var(--title-accent-soft);
    color: var(--title-accent);
}

@media (max-width: 1350px) {
    .prompt-insights-columns {
        display: none;
    }

    .prompt-output-cell__name {
        display: inline;
    }

    .prompt-insights-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .prompt-insights-row:not(.prompt-insights-row--focused) .prompt-insights-prompt {
        grid-column: 1 / -1;
    }

    .prompt-insights-row--focused {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 960.98px) {
    .prompt-insights-row,
    .prompt-insights-row--focused {
        grid-template-columns: 1fr;
    }

    .prompt-insights-row:not(.prompt-insights-row--focused) .prompt-insights-prompt {
        grid-column: auto;
    }

    .prompt-output-cell {
        padding: 0.75rem 0 0;
        border-top: 3px solid var(--border-strong);
        border-left: 0;
    }

    .prompt-insights-prompt-autocomplete {
        min-width: min(20rem, 100%);
        width: 100%;
    }
}

/* ── Inline section help ─────────────────────────────────── */
.client-card-info__inline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    padding: 0;
    margin-left: 0.45rem;
    vertical-align: middle;
    border-radius: 999px;
    border: 0;
    background: var(--action-secondary);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    top: -1px;
}

.client-card-info__inline-btn:hover,
.client-card-info__inline-btn:focus-visible,
.client-card-info__inline-btn[aria-expanded="true"] {
    background: var(--title-accent);
    color: #fff;
    box-shadow: var(--navigation-halo) !important;
    outline: none;
}

.client-card-info__inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 0.8rem;
    line-height: 1;
    font-weight: 700;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.client-card-info__panel {
    margin-top: 0.6rem;
    margin-bottom: 0.85rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--action-secondary);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(22, 51, 95, 0.05) 0%, rgba(22, 51, 95, 0.02) 100%);
    color: var(--text-body);
}

.client-card-info__panel-title {
    margin-bottom: 0.35rem;
    color: var(--text-strong);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.client-card-info__panel-body {
    font-size: 0.9rem;
    line-height: 1.45;
}

.client-card-info__panel-tip {
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--border-strong);
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-muted);
}

@media print {
    .sidebar, .top-row, .nav-scrollable, .aeo-actions, .aeo-breadcrumb, #blazor-error-ui {
        display: none !important;
    }
    main, .content, .aeo-grid, :where(.aeo-card), .aeo-card-title, .aeo-card-subtle, .aeo-kpi, .aeo-badge, .aeo-placeholder, :where(.aeo-muted) {
        color: #222 !important;
        box-shadow: none !important;
        border: 1px solid #bbb !important;
        outline: none !important;
    }
    :where(.aeo-card) {
        page-break-inside: avoid;
        margin-bottom: 1.5rem !important;
    }
    .aeo-print-break {
        break-before: page;
        break-after: page;
        page-break-before: always;
        page-break-after: always;
    }
    .aeo-badge--ok, .aeo-badge--warn, .aeo-badge--bad {
        outline: 2px solid #222 !important;
        border: 1.5px solid #222 !important;
        color: #222 !important;
        background: #fff !important;
    }
    body {
        background: #fff !important;
    }
}
