.insights-studio-page {
    --insights-accent: #0f766e;
    --insights-accent-soft: rgba(15, 118, 110, 0.12);
    --insights-border: rgba(15, 23, 42, 0.08);
    --insights-border-strong: rgba(15, 23, 42, 0.12);
    --insights-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
    --insights-shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.04);
    --insights-surface: #ffffff;
    --insights-surface-alt: #f4f7f8;
    --insights-text-soft: #5f6d7d;
    --insights-text-strong: #0f172a;
}

.insights-studio-header {
    align-items: flex-start;
    gap: 16px;
}

.insights-studio-header-copy {
    max-width: 760px;
}

.insights-studio-kicker {
    color: var(--insights-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.insights-studio-header-copy .page-title {
    margin-bottom: 8px;
}

.insights-studio-header-copy p {
    color: var(--insights-text-soft);
    margin: 0;
    max-width: 680px;
}

.insights-studio-actions {
    flex-wrap: wrap;
}

.insights-studio-shell {
    display: grid;
    gap: 18px;
    grid-template-columns: 280px minmax(0, 1fr) 320px;
    min-height: calc(100vh - 260px);
}

.insights-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 248, 0.92));
    border: 1px solid var(--insights-border);
    border-radius: 24px;
    box-shadow: var(--insights-shadow);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.insights-panel-empty {
    align-items: center;
    justify-content: center;
}

.insights-panel-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 22px 22px 18px;
}

.insights-panel-head h2,
.insights-section-head h3,
.insights-board-card-head h3,
.insights-drilldown-head h3 {
    font-family: "Montserrat", "Inter", sans-serif;
    margin: 0 0 8px;
}

.insights-panel-head p,
.insights-section-note,
.insights-directory-item p,
.insights-source-row p,
.insights-function-row p,
.insights-empty p,
.insights-drilldown-head p,
.insights-board-card-head p,
.insights-drilldown-row p {
    color: var(--insights-text-soft);
    margin: 0;
}

.insights-panel-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.insights-panel-kicker,
.insights-widget-order {
    color: var(--insights-accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.insights-metric-chip {
    align-items: baseline;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    display: inline-flex;
    gap: 8px;
    padding: 8px 12px;
}

.insights-metric-chip span {
    color: var(--insights-text-soft);
    font-size: 12px;
}

.insights-metric-chip strong {
    font-size: 13px;
}

.insights-metric-chip.is-attention {
    border-color: rgba(217, 119, 6, 0.25);
    color: #92400e;
}

.insights-metric-chip.is-muted {
    background: rgba(15, 23, 42, 0.03);
}

.insights-directory-toolbar,
.insights-catalog-toolbar {
    padding: 0 22px 16px;
}

.insights-directory-templates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 22px 18px;
}

.insights-template-chip,
.insights-path-chip {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    color: var(--insights-text-strong);
    cursor: pointer;
    font-size: 12px;
    padding: 9px 12px;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.insights-template-chip:hover,
.insights-path-chip:hover,
.insights-directory-item:hover {
    border-color: rgba(15, 118, 110, 0.28);
    transform: translateY(-1px);
}

.insights-template-card {
    --template-accent: rgba(15, 118, 110, 0.18);
    --template-accent-strong: #0f766e;
    align-items: flex-start;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    line-height: 1.4;
    max-width: 260px;
    min-height: 126px;
    min-width: 180px;
    padding: 14px 15px;
    text-align: left;
    white-space: normal;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.insights-template-card strong,
.insights-template-card small,
.insights-template-card span {
    display: block;
}

.insights-template-card strong {
    color: var(--insights-text-strong);
    font-size: 13px;
    font-weight: 700;
}

.insights-template-card small {
    color: var(--insights-text-soft);
    font-size: 12px;
}

.insights-template-card span {
    align-items: center;
    color: var(--template-accent-strong);
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    gap: 6px;
    letter-spacing: 0.04em;
    margin-top: auto;
    text-transform: uppercase;
}

.insights-template-card::before {
    background: linear-gradient(90deg, var(--template-accent), rgba(255, 255, 255, 0));
    border-radius: 999px;
    content: '';
    display: block;
    height: 4px;
    width: 64px;
}

.insights-template-card[data-accent="emerald"] {
    --template-accent: rgba(16, 185, 129, 0.28);
    --template-accent-strong: #047857;
}

.insights-template-card[data-accent="amber"] {
    --template-accent: rgba(245, 158, 11, 0.3);
    --template-accent-strong: #b45309;
}

.insights-template-card[data-accent="slate"] {
    --template-accent: rgba(100, 116, 139, 0.26);
    --template-accent-strong: #334155;
}

.insights-directory-list,
.insights-catalog-section,
.insights-workspace-panel {
    min-height: 0;
}

.insights-directory-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding: 0 18px 18px;
}

.insights-directory-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    cursor: pointer;
    padding: 14px;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.insights-directory-item.is-active {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.98));
    border-color: rgba(15, 118, 110, 0.28);
}

.insights-directory-item-head,
.insights-directory-item-meta,
.insights-source-meta,
.insights-widget-actions,
.insights-line-labels,
.insights-empty-actions,
.insights-widget-card-footer,
.insights-drilldown-row-meta,
.insights-board-card-meta,
.insights-drilldown-pagination {
    display: flex;
    gap: 10px;
}

.insights-directory-item-head {
    align-items: flex-start;
    justify-content: space-between;
}

.insights-directory-item-meta,
.insights-source-meta {
    color: var(--insights-text-soft);
    flex-wrap: wrap;
    font-size: 12px;
    margin: 8px 0;
}

.insights-workspace-panel {
    padding-bottom: 16px;
}

.insights-workspace-head {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.insights-workspace-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 22px 0;
}

.insights-workspace-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insights-section {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 22px;
    padding: 18px;
}

.insights-section-head {
    align-items: baseline;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.insights-section-head h3 {
    margin-bottom: 0;
}

.insights-settings-grid,
.insights-filters-grid,
.insights-widget-grid {
    gap: 14px 16px;
}

.insights-span-2 {
    grid-column: span 2;
}

.insights-board-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 247, 248, 0.8));
    padding: 20px;
}

.insights-board-section-head {
    margin-bottom: 18px;
}

.insights-board-shell {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
}

.insights-board-shell.has-drawer {
    grid-template-columns: minmax(0, 1fr) 340px;
}

.insights-board-grid {
    align-items: start;
    background:
        linear-gradient(90deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
        linear-gradient(180deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px);
    background-position: 0 0;
    background-size: calc((100% - 176px) / 12 + 16px) 88px;
    border: 1px solid rgba(15, 23, 42, 0.04);
    border-radius: 24px;
    display: grid;
    gap: 16px;
    grid-auto-flow: dense;
    grid-auto-rows: 72px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    min-height: 0;
    padding: 16px;
    position: relative;
}

.insights-board-shell:not(.is-arranging) .insights-board-grid {
    background: transparent;
    border-color: transparent;
    padding: 0;
}

.insights-board-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    box-shadow: var(--insights-shadow-soft);
    display: flex;
    flex-direction: column;
    min-height: 210px;
    overflow: hidden;
    position: relative;
    transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.insights-board-card.is-full {
    grid-column: 1 / -1;
}

.insights-board-card.is-compact {
    min-height: 230px;
}

.insights-board-card.is-tall {
    min-height: 320px;
}

.insights-board-card-head {
    align-items: flex-start;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 18px 18px 16px;
}

.insights-board-card-head h3 {
    margin: 6px 0 4px;
}

.insights-board-card-meta {
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.insights-board-shell.is-arranging .insights-board-card {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.insights-board-card.is-drag-source {
    opacity: 0.55;
}

.insights-layout-pill {
    background: rgba(15, 118, 110, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 999px;
    color: var(--insights-accent);
    font-size: 11px;
    font-weight: 700;
    padding: 7px 10px;
    white-space: nowrap;
}

.insights-board-control {
    align-items: center;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    color: var(--insights-text-soft);
    cursor: grab;
    display: inline-flex;
    font-size: 16px;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    min-height: 34px;
    min-width: 34px;
    padding: 0 10px;
}

.insights-board-control:hover {
    border-color: rgba(15, 118, 110, 0.24);
    color: var(--insights-accent);
}

.insights-board-control:active {
    cursor: grabbing;
}

.insights-board-card-body {
    display: flex;
    flex: 1;
    padding: 18px;
}

.insights-board-resize-handle {
    background:
        linear-gradient(135deg, transparent 45%, rgba(15, 118, 110, 0.85) 45%, rgba(15, 118, 110, 0.85) 55%, transparent 55%),
        linear-gradient(135deg, transparent 62%, rgba(15, 118, 110, 0.55) 62%, rgba(15, 118, 110, 0.55) 72%, transparent 72%);
    border: 0;
    bottom: 10px;
    cursor: nwse-resize;
    height: 22px;
    position: absolute;
    right: 10px;
    width: 22px;
}

.insights-board-drop-preview {
    background: rgba(15, 118, 110, 0.12);
    border: 2px dashed rgba(15, 118, 110, 0.7);
    border-radius: 20px;
    display: none;
    pointer-events: none;
    z-index: 2;
}

.insights-board-drop-preview.is-visible {
    display: block;
}

.insights-preview-state {
    align-items: center;
    color: var(--insights-text-soft);
    display: flex;
    height: 100%;
    justify-content: center;
    min-height: 116px;
    text-align: center;
    width: 100%;
}

.insights-preview-state.is-error {
    color: #b91c1c;
}

.insights-preview-clickable,
.insights-preview-point {
    cursor: pointer;
}

.insights-preview-clickable:hover,
.insights-preview-point:hover {
    border-color: rgba(15, 118, 110, 0.24);
    transform: translateY(-1px);
}

.insights-kpi-preview {
    align-items: flex-start;
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.96));
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    color: inherit;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    min-height: 140px;
    padding: 18px;
    text-align: left;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.insights-kpi-preview span,
.insights-kpi-preview small {
    color: var(--insights-text-soft);
}

.insights-kpi-preview strong {
    font-family: "Montserrat", "Inter", sans-serif;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1;
}

.insights-bar-preview,
.insights-table-body,
.insights-drilldown-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.insights-bar-row,
.insights-table-row {
    align-items: center;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    color: inherit;
    display: grid;
    gap: 10px;
    padding: 10px 12px;
    text-align: left;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.insights-bar-row {
    grid-template-columns: minmax(0, 120px) minmax(0, 1fr) auto;
}

.insights-bar-label,
.insights-bar-value,
.insights-table-head,
.insights-table-row span,
.insights-table-row strong {
    font-size: 12px;
}

.insights-bar-label,
.insights-table-head,
.insights-table-row span {
    color: var(--insights-text-soft);
}

.insights-bar-track {
    background: rgba(15, 23, 42, 0.06);
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.insights-bar-fill {
    background: linear-gradient(90deg, var(--insights-accent), #14b8a6);
    border-radius: 999px;
    height: 100%;
}

.insights-table-preview {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.insights-table-head {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 4px;
    text-transform: uppercase;
}

.insights-table-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.insights-line-preview {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
}

.insights-line-preview svg {
    height: 164px;
    width: 100%;
}

.insights-line-preview circle {
    fill: #14b8a6;
}

.insights-line-path {
    fill: none;
    stroke: var(--insights-accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.insights-line-labels {
    flex-wrap: wrap;
    margin-top: 8px;
}

.insights-line-label {
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 14px;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 92px;
    padding: 10px 12px;
    text-align: left;
    transition: border-color 160ms ease, transform 160ms ease;
}

.insights-line-label span {
    color: var(--insights-text-soft);
    font-size: 11px;
}

.insights-drilldown-drawer {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    box-shadow: var(--insights-shadow-soft);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.insights-drilldown-head {
    align-items: flex-start;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 18px 18px 16px;
}

.insights-drilldown-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 16px 18px;
}

.insights-drilldown-row {
    background: rgba(244, 247, 248, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    padding: 12px 14px;
}

.insights-drilldown-row-head,
.insights-drilldown-footer {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.insights-drilldown-row-head strong,
.insights-table-row strong {
    color: var(--insights-text-strong);
}

.insights-drilldown-row-head span,
.insights-drilldown-count {
    color: var(--insights-text-soft);
    font-size: 12px;
}

.insights-drilldown-row-meta {
    color: var(--insights-text-soft);
    flex-wrap: wrap;
    font-size: 12px;
    margin: 10px 0 0;
}

.insights-drilldown-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.05);
    padding: 14px 18px 16px;
}

.insights-drilldown-pagination {
    align-items: center;
    flex-wrap: wrap;
}

.insights-widgets-section {
    margin: 0;
}

.insights-widgets-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.insights-widget-card {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 22px;
    overflow: hidden;
}

.insights-widget-card-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 16px 18px;
}

.insights-widget-card-head h4 {
    margin: 6px 0 4px;
}

.insights-widget-meta {
    color: var(--insights-text-soft);
    font-size: 12px;
}

.insights-widget-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.insights-widget-card-body {
    border-top: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.insights-widget-card-footer {
    align-items: center;
    justify-content: space-between;
}

.insights-status-pill {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 999px;
    color: var(--insights-text-soft);
    display: inline-flex;
    font-size: 12px;
    gap: 6px;
    padding: 8px 10px;
}

.insights-status-pill.is-ready {
    background: rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.14);
    color: var(--insights-accent);
}

.insights-status-pill.is-loading {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.16);
    color: #2563eb;
}

.insights-status-pill.is-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.16);
    color: #b91c1c;
}

.insights-catalog {
    min-height: 0;
}

.insights-catalog .insights-panel {
    height: 100%;
}

.insights-catalog-section {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding: 18px 22px;
}

.insights-catalog-section h3 {
    margin: 0 0 12px;
}

.insights-source-list,
.insights-function-list,
.insights-catalog-entities {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.insights-source-row,
.insights-function-row,
.insights-entity-group {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    padding: 14px;
}

.insights-entity-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.insights-entity-head span {
    color: var(--insights-text-soft);
    font-size: 12px;
}

.insights-path-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.insights-empty {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: auto;
    max-width: 460px;
    padding: 34px 24px;
    text-align: center;
}

.insights-empty-inline {
    background: rgba(255, 255, 255, 0.76);
    border: 1px dashed rgba(15, 23, 42, 0.12);
    border-radius: 20px;
    margin: 0;
    max-width: none;
}

.insights-board-empty {
    min-height: 240px;
}

.insights-empty-actions {
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

@media (max-width: 1560px) {
    .insights-board-shell.has-drawer {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 1440px) {
    .insights-studio-shell {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .insights-studio-catalog {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1180px) {
    .insights-board-grid {
        background: transparent;
        border-color: transparent;
        grid-auto-rows: auto;
        grid-template-columns: 1fr;
        padding: 0;
    }

    .insights-board-card,
    .insights-board-card.is-full {
        grid-column: auto !important;
        grid-row: auto !important;
    }
}

@media (max-width: 1040px) {
    .insights-studio-shell,
    .insights-workspace-grid {
        grid-template-columns: 1fr;
    }

    .insights-span-2 {
        grid-column: span 1;
    }

    .insights-board-section,
    .insights-workspace-stack {
        padding-left: 0;
        padding-right: 0;
    }

    .insights-workspace-stack {
        padding-top: 20px;
    }
}

@media (max-width: 720px) {
    .insights-panel-head,
    .insights-board-card-head,
    .insights-widget-card-head,
    .insights-drilldown-head,
    .insights-drilldown-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .insights-board-card-meta,
    .insights-widget-card-footer,
    .insights-drilldown-pagination {
        justify-content: flex-start;
    }

    .insights-bar-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .insights-table-head,
    .insights-table-row {
        grid-template-columns: minmax(0, 1fr);
    }
}
