/**
 * SightOps workspace shell — page layout, dashboard workspace, tables/forms polish.
 * Load after style.css. Additive only; does not replace legacy rules.
 */
.workspace-container {
    width: 100%;
    max-width: min(var(--content-max-wide, 1440px), 100%);
    margin-left: auto;
    margin-right: auto;
}

.page-title {
    font-size: var(--text-xl, 1.35rem);
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin: 0 0 var(--page-header-gap, 0.35rem) 0;
}

.page h2.page-title {
    margin-bottom: var(--page-header-gap, 0.35rem);
}

.page-subtitle {
    margin: 0 0 var(--section-gap, 1.5rem) 0;
    font-size: var(--text-sm, 0.8125rem);
    color: var(--text-secondary);
    max-width: 42rem;
    line-height: var(--leading-snug);
}

.section-spacing {
    margin-bottom: var(--form-section-gap, 1.75rem);
}

.content-grid {
    display: grid;
    gap: var(--spacing-md, 1.25rem);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ——— Dashboard workspace layout ——— */
.stats-grid--dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem 1.15rem;
    align-items: stretch;
}

.stats-section-label {
    grid-column: 1 / -1;
    margin: 0.25rem 0 0.15rem;
    padding-top: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.stats-section-label:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.stat-card--hero {
    border-color: rgba(20, 184, 166, 0.2);
    box-shadow: var(--shadow-soft), 0 0 0 1px rgba(20, 184, 166, 0.06);
}

.stat-card--hero .stat-info h3 {
    font-size: 1.85rem;
}

.stat-card--alert {
    border-color: rgba(245, 158, 11, 0.25);
}

.stat-icon--hero {
    width: 56px;
    height: 56px;
    font-size: var(--icon-size-stat, 1.35rem);
    background: linear-gradient(145deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.25);
}

.stat-icon--muted {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
    background: var(--surface-muted);
    color: var(--primary-dark);
    box-shadow: none;
}

.stat-icon--alert {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.08));
    color: #b45309;
    box-shadow: none;
}

/* ——— Form patterns ——— */
.form-section {
    margin-bottom: var(--form-section-gap, 1.75rem);
    padding-bottom: var(--form-section-gap, 1.75rem);
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.form-hint,
.form-help {
    display: block;
    margin-top: 0.35rem;
    font-size: var(--text-xs, 0.75rem);
    line-height: var(--leading-snug);
    color: var(--helper-text-color);
}

/* ——— Table toolbar (opt-in wrapper) ——— */
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
}

.table-container--dense td,
.table-container--dense th {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* ——— Buttons ——— */
.btn.is-loading {
    position: relative;
    pointer-events: none;
    opacity: var(--opacity-hover, 0.92);
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    right: 0.65rem;
    top: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    animation: so-spin 0.75s linear infinite;
}

.btn.btn-secondary.is-loading::after,
.btn.btn-outline.is-loading::after {
    border-color: rgba(15, 23, 42, 0.12);
    border-top-color: var(--primary-color);
}

.btn-danger:hover {
    filter: brightness(0.96);
}

/* ——— Empty state panel (EmptyStateWatermark optional action) ——— */
.empty-state-watermark.empty-state-panel {
    min-height: 240px;
}

.empty-state-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.empty-state-action.btn {
    min-height: var(--tap-target-min, 2.75rem);
}

/* ——— Dashboard controls (toolbar) ——— */
.dashboard-toolbar {
    padding: 0.65rem 1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
}

.dashboard-hint {
    margin-bottom: 1.25rem;
}
