:root {
    --dashboard-primary: #2563eb;
    --dashboard-primary-soft: #eff6ff;
    --dashboard-border: #e2e8f0;
    --dashboard-text: #0f172a;
    --dashboard-muted: #64748b;
    --dashboard-surface: #ffffff;
    --dashboard-bg: #f8fafc;
}

.dashboard-builder,
.dashboard-custom-panel,
.dashboard-modal {
    color: var(--dashboard-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.dashboard-builder {
    margin-top: 1rem;
}

.dashboard-toolbar {
    align-items: center;
    background: var(--dashboard-surface);
    border: 1px solid var(--dashboard-border);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(15, 23, 42, .05);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 58px;
    padding: .55rem .7rem;
}

.dashboard-toolbar-mark {
    align-items: center;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.dashboard-tabs-wrap,
.dashboard-tabs,
.dashboard-actions {
    align-items: center;
    display: flex;
}

.dashboard-create-wrap {
    position: relative;
}

.dashboard-create-menu {
    background: #fff;
    border: 1px solid var(--dashboard-border);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .16);
    min-width: 310px;
    padding: .4rem;
    position: absolute;
    right: 0;
    top: calc(100% + .55rem);
    z-index: 1060;
}

.dashboard-create-menu[hidden] {
    display: none;
}

.dashboard-create-menu > button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: #1e293b;
    display: flex;
    gap: .75rem;
    padding: .7rem;
    text-align: left;
    width: 100%;
}

.dashboard-create-menu > button:hover,
.dashboard-create-menu > button:focus {
    background: #f1f5f9;
    outline: none;
}

.dashboard-create-menu strong,
.dashboard-create-menu small {
    display: block;
}

.dashboard-create-menu strong {
    font-size: .84rem;
}

.dashboard-create-menu small {
    color: var(--dashboard-muted);
    font-size: .72rem;
    margin-top: .12rem;
}

.dashboard-menu-icon {
    align-items: center;
    background: var(--dashboard-primary-soft);
    border-radius: 8px;
    color: var(--dashboard-primary);
    display: flex;
    flex: 0 0 auto;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.dashboard-tabs-wrap {
    gap: .35rem;
    min-width: 0;
}

.dashboard-tabs {
    gap: .3rem;
    max-width: min(64vw, 780px);
    overflow-x: auto;
    padding: .1rem;
    scrollbar-width: thin;
}

.dashboard-tab,
.dashboard-add-page {
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #475569;
    cursor: pointer;
    flex: 0 0 auto;
    font-size: .9rem;
    font-weight: 600;
    min-height: 38px;
    padding: .5rem .8rem;
    transition: background .15s ease, color .15s ease;
}

.dashboard-tab:hover,
.dashboard-add-page:hover {
    background: #f1f5f9;
    color: var(--dashboard-primary);
}

.dashboard-tab.is-active {
    background: var(--dashboard-primary-soft);
    color: var(--dashboard-primary);
}

.dashboard-add-page {
    border-left: 1px solid var(--dashboard-border);
    border-radius: 0 8px 8px 0;
    white-space: nowrap;
}

.dashboard-add-page i {
    margin-right: .35rem;
}

.dashboard-actions {
    flex: 0 0 auto;
    gap: .4rem;
}

.dashboard-limit-text {
    color: var(--dashboard-muted);
    font-size: .76rem;
    white-space: nowrap;
}

.dashboard-alert {
    border-radius: 8px;
    font-size: .88rem;
    margin: .6rem 0 0;
    padding: .65rem .85rem;
}

.dashboard-alert.is-success {
    background: #ecfdf5;
    color: #047857;
}

.dashboard-alert.is-error {
    background: #fef2f2;
    color: #b91c1c;
}

.dashboard-custom-panel {
    background: var(--dashboard-bg);
    margin-top: 1rem;
    min-height: 420px;
    padding: 1rem;
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-layout-row {
    --row-height: 500px;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    height: var(--row-height);
    min-height: 360px;
    position: relative;
}

.dashboard-empty {
    align-items: center;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 2rem auto;
    max-width: 680px;
    min-height: 320px;
    padding: 2rem;
    text-align: center;
}

.dashboard-empty-icon {
    align-items: center;
    background: var(--dashboard-primary-soft);
    border-radius: 50%;
    color: var(--dashboard-primary);
    display: flex;
    font-size: 1.6rem;
    height: 60px;
    justify-content: center;
    margin-bottom: 1rem;
    width: 60px;
}

.dashboard-empty h3 {
    font-size: 1.15rem;
    margin-bottom: .4rem;
}

.dashboard-empty p {
    color: var(--dashboard-muted);
    margin-bottom: 1.2rem;
}

.dashboard-chart-card {
    --chart-span: 6;
    background: var(--dashboard-surface);
    border: 1px solid var(--dashboard-border);
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(15, 23, 42, .06);
    grid-column: span var(--chart-span);
    height: 100%;
    min-height: 0;
    min-width: 0;
    position: relative;
    transition: box-shadow .18s ease, opacity .18s ease;
}

.dashboard-chart-card:hover {
    box-shadow: 0 8px 25px rgba(15, 23, 42, .1);
}

.dashboard-chart-card.is-dragging {
    opacity: .45;
}

.dashboard-chart-card.is-drop-target {
    outline: 2px solid var(--dashboard-primary);
    outline-offset: 2px;
}

.dashboard-card-header {
    align-items: center;
    border-bottom: 1px solid #eef2f7;
    cursor: grab;
    display: flex;
    gap: .65rem;
    height: 56px;
    justify-content: space-between;
    padding: .6rem .65rem .6rem .9rem;
    user-select: none;
}

.dashboard-card-header:active {
    cursor: grabbing;
}

.dashboard-card-title-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-card-title-row {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 0;
}

.dashboard-card-title {
    flex: 1 1 auto;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-card-meta {
    color: var(--dashboard-muted);
    display: block;
    font-size: .72rem;
    margin-top: .15rem;
}

.dashboard-period-badge {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    height: 20px;
    justify-content: center;
    letter-spacing: .025em;
    line-height: 18px;
    min-width: 38px;
    padding: 0 7px;
    text-transform: none;
    white-space: nowrap;
}

.dashboard-period-badge.is-yearly {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.dashboard-period-badge.is-ttm {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #6d28d9;
}

.dashboard-period-badge.is-ytd {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}

.dashboard-card-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
}

.dashboard-drag-handle {
    cursor: grab;
}

.dashboard-drag-handle:active {
    cursor: grabbing;
}

.dashboard-mobile-action {
    display: none;
}

body.dashboard-is-resizing,
body.dashboard-is-resizing * {
    cursor: nwse-resize !important;
    user-select: none !important;
}

.dashboard-icon-btn {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #64748b;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.dashboard-icon-btn:hover {
    background: #f1f5f9;
    color: var(--dashboard-primary);
}

.dashboard-chart-host {
    height: calc(100% - 57px);
    min-width: 0;
    padding: .25rem;
}

.dashboard-chart-loading,
.dashboard-chart-error {
    align-items: center;
    color: var(--dashboard-muted);
    display: flex;
    font-size: .88rem;
    height: 100%;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.dashboard-chart-error {
    color: #b91c1c;
}

.dashboard-resize-handle {
    border-bottom: 3px solid #94a3b8;
    border-right: 3px solid #94a3b8;
    bottom: 6px;
    cursor: nwse-resize;
    height: 14px;
    opacity: .55;
    position: absolute;
    right: 6px;
    touch-action: none;
    width: 14px;
    z-index: 5;
}

.dashboard-insert-after {
    align-items: center;
    background: var(--dashboard-primary);
    border: 2px solid white;
    border-radius: 50%;
    bottom: auto;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
    color: white;
    display: flex;
    height: 28px;
    justify-content: center;
    left: auto;
    opacity: 0;
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%) scale(.8);
    transition: opacity .15s ease, transform .15s ease;
    width: 28px;
    z-index: 8;
}

.dashboard-chart-card:hover .dashboard-insert-after,
.dashboard-insert-after:focus {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.dashboard-chart-card.is-row-end .dashboard-insert-after {
    bottom: -14px;
    left: 50%;
    right: auto;
    top: auto;
    transform: translateX(-50%) scale(.8);
}

.dashboard-chart-card.is-row-end:hover .dashboard-insert-after,
.dashboard-chart-card.is-row-end .dashboard-insert-after:focus {
    transform: translateX(-50%) scale(1);
}

.dashboard-modal .modal-content {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 22px 65px rgba(15, 23, 42, .2);
    overflow: hidden;
}

.dashboard-modal .modal-header {
    align-items: flex-start;
    border-bottom-color: var(--dashboard-border);
}

.dashboard-modal-heading {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.dashboard-modal-heading-icon {
    align-items: center;
    background: var(--dashboard-primary-soft);
    border-radius: 9px;
    color: var(--dashboard-primary);
    display: flex;
    flex: 0 0 auto;
    font-size: 1rem;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.dashboard-modal-subtitle {
    color: var(--dashboard-muted);
    font-size: .82rem;
    margin: .2rem 0 0;
}

.dashboard-chart-modal-header {
    padding: 1rem 1.25rem;
}

.dashboard-chart-builder {
    background: var(--dashboard-bg);
    padding: 1rem 1.25rem;
}

.dashboard-kind-switch {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.dashboard-kind {
    align-items: center;
    background: white;
    border: 1px solid var(--dashboard-border);
    border-radius: 10px;
    color: #334155;
    display: flex;
    gap: .75rem;
    padding: .75rem 1rem;
    text-align: left;
}

.dashboard-kind > i {
    align-items: center;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    font-size: 1.1rem;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.dashboard-kind span,
.dashboard-kind small {
    display: block;
}

.dashboard-kind small {
    color: var(--dashboard-muted);
    font-size: .74rem;
    margin-top: .12rem;
}

.dashboard-kind.is-active {
    background: var(--dashboard-primary-soft);
    border-color: #93c5fd;
    color: #1d4ed8;
}

.dashboard-kind.is-active > i {
    background: #dbeafe;
}

.dashboard-builder-controls {
    align-items: end;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(220px, 1fr) 170px 125px;
    margin-bottom: .85rem;
}

.dashboard-display-settings {
    align-items: center;
    background: #fff;
    border: 1px solid var(--dashboard-border);
    border-radius: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    justify-content: flex-end;
    margin-bottom: .85rem;
    padding: .5rem .65rem;
}

.dashboard-display-setting,
.dashboard-grid-settings {
    align-items: center;
    display: flex;
    gap: .55rem;
}

.dashboard-control-label {
    color: #475569;
    font-size: .72rem;
    font-weight: 750;
}

.dashboard-segmented {
    background: #f1f5f9;
    border-radius: 7px;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
}

.dashboard-segmented button {
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #64748b;
    font-size: .7rem;
    font-weight: 650;
    min-height: 27px;
    padding: .25rem .55rem;
}

.dashboard-segmented button.is-active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
    color: #1e293b;
}

.dashboard-grid-settings label {
    align-items: center;
    color: #475569;
    display: inline-flex;
    font-size: .72rem;
    gap: .25rem;
    margin: 0;
}

.dashboard-builder-controls .form-group {
    margin: 0;
}

.dashboard-builder-controls label,
.dashboard-stock-picker label {
    color: #475569;
    font-size: .76rem;
    font-weight: 700;
    margin-bottom: .3rem;
}

.dashboard-switch {
    align-items: center;
    cursor: pointer;
    display: flex !important;
    font-weight: 500 !important;
    gap: .4rem;
    min-height: 31px;
}

.dashboard-switch input {
    height: 16px;
    width: 16px;
}

.dashboard-selector-layout {
    background: white;
    border: 1px solid var(--dashboard-border);
    border-radius: 10px;
    display: grid;
    grid-template-columns: 205px minmax(300px, 1fr) minmax(265px, 330px);
    min-height: 410px;
    overflow: hidden;
}

.dashboard-category-pane,
.dashboard-selected-pane {
    background: #f8fafc;
    padding: .9rem;
}

.dashboard-category-pane {
    border-right: 1px solid var(--dashboard-border);
}

.dashboard-selected-pane {
    border-left: 1px solid var(--dashboard-border);
}

.dashboard-pane-title {
    color: #334155;
    font-size: .77rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dashboard-category-list {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-top: .55rem;
}

.dashboard-category-button {
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #475569;
    font-size: .84rem;
    padding: .55rem .65rem;
    text-align: left;
}

.dashboard-category-button:hover,
.dashboard-category-button.is-active {
    background: #eaf2ff;
    color: #1d4ed8;
}

.dashboard-metric-pane {
    min-width: 0;
    padding: .9rem;
}

.dashboard-metric-head,
.dashboard-selected-head {
    align-items: center;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.dashboard-search {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--dashboard-border);
    border-radius: 7px;
    display: flex;
    max-width: 250px;
    padding: 0 .55rem;
    width: 55%;
}

.dashboard-search i {
    color: #94a3b8;
    font-size: .78rem;
}

.dashboard-search input {
    background: transparent;
    border: 0;
    font-size: .8rem;
    outline: none;
    padding: .4rem .45rem;
    width: 100%;
}

.dashboard-metric-list {
    margin-top: .65rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: .25rem;
}

.dashboard-metric-row {
    align-items: flex-start;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    display: flex;
    gap: .55rem;
    margin: 0;
    padding: .56rem .35rem .56rem calc(.35rem + var(--dashboard-metric-indent, 0px));
}

.dashboard-metric-row:hover {
    background: #f8fafc;
}

.dashboard-metric-row:focus-within {
    box-shadow: inset 0 0 0 1px #93c5fd;
    outline: none;
}

.dashboard-metric-row.is-parent {
    background: #fbfdff;
}

.dashboard-metric-row.is-parent:hover {
    background: #f3f7fc;
}

.dashboard-metric-row.is-parent .dashboard-metric-name {
    color: #0f172a;
    font-weight: 750;
}

.dashboard-metric-row.is-child .dashboard-metric-name {
    color: #475569;
}

.dashboard-metric-row input {
    flex: 0 0 auto;
    margin-top: .2rem;
    outline: none;
}

.dashboard-metric-copy {
    min-width: 0;
}

.dashboard-metric-name {
    color: #334155;
    display: block;
    font-size: .81rem;
    line-height: 1.35;
}

.dashboard-metric-unit {
    color: #94a3b8;
    display: block;
    font-size: .69rem;
    margin-top: .14rem;
}

.dashboard-selected-head > span {
    color: var(--dashboard-muted);
    font-size: .72rem;
}

.dashboard-stock-picker {
    border-bottom: 1px solid var(--dashboard-border);
    margin: .65rem 0;
    padding-bottom: .65rem;
}

.dashboard-selected-series {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .65rem;
    max-height: 330px;
    overflow-y: auto;
}

.dashboard-series-empty {
    color: #94a3b8;
    font-size: .8rem;
    padding: 2.2rem .75rem;
    text-align: center;
}

.dashboard-series-item {
    background: white;
    border: 1px solid var(--dashboard-border);
    border-radius: 8px;
    display: grid;
    gap: .35rem;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    min-width: 0;
    padding: .45rem;
}

.dashboard-series-top {
    align-items: center;
    display: contents;
}

.dashboard-series-name {
    align-items: center;
    display: flex;
    font-size: .78rem;
    font-weight: 650;
    gap: .35rem;
    line-height: 1.3;
    min-width: 0;
}

.dashboard-series-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-series-drag {
    align-items: center;
    background: transparent;
    border: 0;
    color: #94a3b8;
    cursor: grab;
    display: flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 22px;
}

.dashboard-series-stock {
    background: #e0e7ff;
    border-radius: 4px;
    color: #4338ca;
    display: inline-block;
    font-size: .65rem;
    font-weight: 800;
    flex: 0 0 auto;
    margin-right: 0;
    padding: .1rem .3rem;
}

.dashboard-series-remove {
    background: transparent;
    border: 0;
    color: #94a3b8;
    flex: 0 0 auto;
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 30px;
}

.dashboard-series-remove:hover {
    color: #dc2626;
}

.dashboard-series-options {
    align-items: center;
    display: flex;
    gap: .35rem;
    grid-column: 2 / 4;
    justify-content: flex-end;
    margin-top: 0;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.dashboard-series-style,
.dashboard-series-order {
    align-items: center;
    background: #fff;
    border: 1px solid var(--dashboard-border);
    border-radius: 5px;
    color: #64748b;
    display: inline-flex;
    font-size: .7rem;
    height: 28px;
    justify-content: center;
    padding: 0 .45rem;
}

.dashboard-series-style:hover,
.dashboard-series-order:hover {
    background: #f1f5f9;
    color: var(--dashboard-primary);
}

.dashboard-series-style:focus,
.dashboard-series-order:focus,
.dashboard-series-remove:focus {
    outline: none;
}

.dashboard-series-style:focus-visible,
.dashboard-series-order:focus-visible,
.dashboard-series-remove:focus-visible {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .35);
}

.dashboard-series-style {
    box-sizing: border-box;
    flex: 1 1 0;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.dashboard-series-order {
    flex: 0 0 28px;
    padding-left: 0;
    padding-right: 0;
    width: 28px;
}

.dashboard-series-style-label {
    display: block;
    flex: 1 1 auto;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-series-order:disabled {
    cursor: default;
    opacity: .35;
}

.dashboard-series-style-swatch {
    border-radius: 3px;
    display: inline-block;
    flex: 0 0 12px;
    height: 12px;
    margin-right: .35rem;
    width: 12px;
}

.dashboard-series-style > .fa {
    flex: 0 0 auto;
}

.dashboard-series-item.is-series-dragging {
    opacity: .45;
}

.dashboard-series-item.is-series-drop-target {
    border-color: var(--dashboard-primary);
    box-shadow: 0 0 0 1px var(--dashboard-primary);
}

.dashboard-series-item.is-hidden {
    background: #f8fafc;
    opacity: .68;
}

.dashboard-style-popover {
    background: #fff;
    border: 1px solid var(--dashboard-border);
    border-radius: 12px;
    box-sizing: border-box;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
    max-height: min(76vh, 500px);
    max-width: calc(100vw - 16px);
    min-width: 316px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .62rem;
    position: fixed;
    width: 316px;
    z-index: 2000;
}

.dashboard-style-popover * {
    box-sizing: border-box;
    min-width: 0;
}

.dashboard-style-popover[hidden] {
    display: none;
}

.dashboard-style-section {
    margin-bottom: .58rem;
}

.dashboard-style-label {
    color: #334155;
    display: flex;
    font-size: .72rem;
    font-weight: 750;
    justify-content: space-between;
    margin-bottom: .38rem;
}

.dashboard-style-label small {
    color: #94a3b8;
    font-size: .65rem;
    font-weight: 500;
}

.dashboard-chart-types {
    display: grid;
    gap: .32rem;
    grid-template-columns: repeat(5, 1fr);
}

.dashboard-chart-types button,
.dashboard-line-options button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--dashboard-border);
    border-radius: 7px;
    color: #64748b;
    display: flex;
    height: 34px;
    justify-content: center;
}

.dashboard-chart-types button:hover,
.dashboard-chart-types button.is-active,
.dashboard-line-options button:hover,
.dashboard-line-options button.is-active {
    background: var(--dashboard-primary-soft);
    border-color: #60a5fa;
    color: #1d4ed8;
}

.dashboard-chart-type-icon {
    display: block;
    height: 20px;
    overflow: visible;
    width: 24px;
}

.dashboard-type-donut {
    border: 5px solid currentColor;
    border-radius: 50%;
    display: block;
    height: 20px;
    width: 20px;
}

.dashboard-color-palette {
    display: grid;
    gap: .35rem;
    grid-template-columns: repeat(9, 24px);
}

.dashboard-color-choice {
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 6px;
    height: 24px;
    padding: 0;
    position: relative;
    width: 24px;
}

.dashboard-color-choice.is-active::after {
    border: 2px solid #fff;
    border-radius: 3px;
    box-shadow: 0 0 0 2px #2563eb;
    content: "";
    inset: 3px;
    position: absolute;
}

.dashboard-color-choice.is-custom {
    background: conic-gradient(#ef4444, #facc15, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444);
}

.dashboard-style-row {
    display: grid;
    gap: .8rem;
    grid-template-columns: 1fr 1fr;
}

.dashboard-line-options {
    display: grid;
    gap: .28rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
}

.dashboard-line-options button {
    height: 30px;
    width: 100%;
}

.dashboard-line-options button > span {
    background: currentColor;
    display: block;
    width: 19px;
}

.dashboard-line-options .is-dashed,
.dashboard-line-options .is-dotted,
.dashboard-line-options .is-dash-dot {
    background: transparent;
    height: 0;
}

.dashboard-line-options .is-dashed {
    border-top: 2px dashed currentColor;
}

.dashboard-line-options .is-dotted {
    border-top: 2px dotted currentColor;
}

.dashboard-line-options .is-dash-dot {
    border-top: 2px dashed currentColor;
    position: relative;
}

.dashboard-line-options .is-dash-dot::after {
    background: #fff;
    content: "";
    height: 3px;
    left: 8px;
    position: absolute;
    top: -2px;
    width: 2px;
}

.dashboard-axis-options {
    display: grid;
    gap: .25rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-axis-options button {
    background: #fff;
    border: 1px solid var(--dashboard-border);
    border-radius: 7px;
    color: #64748b;
    font-size: .66rem;
    min-height: 28px;
    padding: .22rem .18rem;
}

.dashboard-axis-options button:hover,
.dashboard-axis-options button.is-active {
    background: var(--dashboard-primary-soft);
    border-color: #60a5fa;
    color: #1d4ed8;
}

.dashboard-axis-options .dashboard-axis-auto {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.dashboard-chart-footer {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.dashboard-help-text {
    color: var(--dashboard-muted);
    font-size: .75rem;
}

#dashboard-default-panel #list-chart > [id^="chart_"] {
    min-height: 500px;
}

@media (min-width: 1200px) {
    .dashboard-modal .modal-xl {
        max-width: 1180px;
    }
}

@media (max-width: 991.98px) {
    .dashboard-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: .5rem;
    }

    .dashboard-tabs {
        max-width: calc(100vw - 155px);
    }

    .dashboard-actions {
        border-top: 1px solid #f1f5f9;
        justify-content: flex-end;
        padding-top: .5rem;
    }

    .dashboard-selector-layout {
        grid-template-columns: 170px minmax(280px, 1fr);
    }

    .dashboard-selected-pane {
        border-left: 0;
        border-top: 1px solid var(--dashboard-border);
        grid-column: 1 / -1;
    }

    .dashboard-selected-series {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 220px;
    }
}

@media (max-width: 767.98px) {
    .dashboard-builder {
        margin-top: .65rem;
        padding-left: .5rem;
        padding-right: .5rem;
        position: relative;
        z-index: 15;
    }

    .dashboard-toolbar-mark {
        display: none;
    }

    .dashboard-create-menu {
        max-width: calc(100vw - 1rem);
        min-width: 290px;
        position: fixed;
        right: .5rem;
        top: 8.4rem;
    }

    .dashboard-display-settings {
        align-items: stretch;
        justify-content: flex-start;
    }

    .dashboard-display-setting {
        justify-content: space-between;
        width: 100%;
    }

    .dashboard-tab,
    .dashboard-add-page {
        font-size: .82rem;
        padding: .45rem .6rem;
    }

    .dashboard-add-page span,
    .dashboard-limit-text {
        display: none;
    }

    .dashboard-add-page i {
        margin: 0;
    }

    .dashboard-tabs {
        max-width: calc(100vw - 72px);
    }

    .dashboard-custom-panel {
        padding: .6rem;
    }

    .dashboard-grid {
        gap: .8rem;
    }

    .dashboard-layout-row {
        min-height: 420px;
    }

    .dashboard-chart-card {
        grid-column: 1 / -1 !important;
    }

    .dashboard-card-header {
        cursor: default;
    }

    .dashboard-drag-handle {
        display: none;
    }

    .dashboard-mobile-action {
        display: inline-flex;
    }

    .dashboard-resize-handle {
        cursor: ns-resize;
    }

    .dashboard-insert-after {
        opacity: 1;
        transform: translateX(-50%) scale(.9);
    }

    .dashboard-modal .modal-dialog {
        margin: .45rem;
        max-width: none;
    }

    .dashboard-modal .modal-content {
        max-height: calc(100vh - .9rem);
    }

    .dashboard-chart-builder {
        overflow-y: auto;
        padding: .75rem;
    }

    .dashboard-kind-switch {
        gap: .45rem;
    }

    .dashboard-kind {
        align-items: flex-start;
        padding: .6rem;
    }

    .dashboard-kind > i {
        display: none;
    }

    .dashboard-kind strong {
        font-size: .78rem;
    }

    .dashboard-kind small {
        font-size: .66rem;
    }

    .dashboard-builder-controls {
        grid-template-columns: minmax(0, 1fr) 105px;
    }

    .dashboard-legend-field {
        grid-column: 1 / -1;
    }

    .dashboard-selector-layout {
        display: block;
        max-height: 58vh;
        overflow-y: auto;
    }

    .dashboard-category-pane,
    .dashboard-selected-pane {
        border: 0;
        padding: .7rem;
    }

    .dashboard-category-pane {
        border-bottom: 1px solid var(--dashboard-border);
    }

    .dashboard-category-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: .2rem;
    }

    .dashboard-category-button {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .dashboard-metric-pane {
        padding: .7rem;
    }

    .dashboard-search {
        width: 65%;
    }

    .dashboard-metric-list {
        max-height: 230px;
    }

    .dashboard-selected-series {
        display: flex;
        max-height: none;
    }

    .dashboard-style-popover {
        bottom: .5rem !important;
        left: .5rem !important;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        min-width: 0;
        right: .5rem !important;
        top: auto !important;
        width: auto;
    }

    .dashboard-chart-footer {
        align-items: stretch;
        flex-direction: column;
        gap: .6rem;
    }

    .dashboard-chart-footer > div {
        display: flex;
        justify-content: flex-end;
    }
}

@media (max-width: 420px) {
    .dashboard-actions .btn-light {
        padding-left: .45rem;
        padding-right: .45rem;
    }

    .dashboard-actions .btn-primary {
        font-size: .78rem;
    }

    .dashboard-series-options {
        flex-wrap: wrap;
    }

    .dashboard-style-row {
        grid-template-columns: 1fr;
    }

    .dashboard-color-palette {
        grid-template-columns: repeat(9, 1fr);
    }

    .dashboard-color-choice {
        aspect-ratio: 1;
        height: auto;
        max-width: 24px;
        width: 100%;
    }
}

/* ======================================================================
   Lovable UI parity layer
   The selectors below deliberately sit after the legacy Bootstrap rules.
   They reproduce the Insight Charts shell while keeping the existing API
   and dashboard behaviour intact.
   ====================================================================== */

#dashboard-builder,
.dashboard-default-panel,
.dashboard-custom-panel,
.dashboard-modal,
.dashboard-style-popover {
    color: #111827;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

#dashboard-builder * {
    box-sizing: border-box;
}

.dashboard-builder {
    background: #f5f6f8;
    border: 0;
    margin: 0;
    padding: 24px 20px 0;
    position: relative;
    z-index: 25;
}

.dashboard-section-head {
    margin: 0 auto;
    max-width: 1600px;
}

.dashboard-section-head h1 {
    color: var(--whatever-ink, #1d2738);
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -.025em;
    line-height: 1.3;
    margin: 0;
}

.dashboard-section-head .dashboard-stock-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-company-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-stock-badge {
    background: var(--whatever-primary, #2563eb);
    border: 1px solid var(--whatever-primary, #2563eb);
    border-radius: 999px;
    color: #fff;
    flex: 0 0 auto;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    letter-spacing: .045em;
    line-height: 1;
    padding: 5px 9px;
}

.dashboard-section-head p {
    color: var(--whatever-muted, #667085);
    font-size: 14px;
    line-height: 1.5;
    margin: 3px 0 0;
}

.dashboard-topbar {
    align-items: center;
    background: #fff;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    min-height: 60px;
    padding: 12px 20px;
}

.dashboard-topbar-left,
.dashboard-topbar-right,
.dashboard-brand,
.dashboard-pagebar {
    align-items: center;
    display: flex;
}

.dashboard-topbar-left {
    gap: 16px;
    min-width: 0;
}

.dashboard-topbar-right {
    flex: 0 0 auto;
    gap: 7px;
}

.dashboard-brand {
    color: #0f172a;
    flex: 0 0 auto;
    font-weight: 700;
    gap: 8px;
}

.dashboard-brand-mark {
    align-items: center;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-size: 12px;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.dashboard-brand-name {
    font-size: 15px;
}

.dashboard-crumbs {
    align-items: center;
    color: #6b7280;
    display: flex;
    font-size: 13px;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-crumb-separator {
    color: #d1d5db;
}

.dashboard-primary-button,
.dashboard-outline-button,
.dashboard-ghost-button,
.dashboard-topbar-icon {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    gap: 6px;
    justify-content: center;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.dashboard-primary-button {
    background: var(--whatever-primary, #2f66ea);
    border: 1px solid var(--whatever-primary, #2f66ea);
    color: #fff;
}

.dashboard-primary-button:hover,
.dashboard-primary-button:focus {
    background: var(--whatever-primary-dark, #2858d3);
    border-color: var(--whatever-primary-dark, #2858d3);
    color: #fff;
    outline: none;
}

.dashboard-outline-button {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #111827;
}

.dashboard-outline-button:hover,
.dashboard-outline-button:focus,
.dashboard-ghost-button:hover,
.dashboard-ghost-button:focus {
    background: #f3f4f6;
    color: #111827;
    outline: none;
}

.dashboard-ghost-button {
    background: transparent;
    border: 1px solid transparent;
    color: #4b5563;
}

.dashboard-small-button {
    font-size: 12px;
    min-height: 32px;
    padding: 6px 10px;
}

.dashboard-topbar-icon {
    background: #fff;
    border: 1px solid var(--whatever-border, #e1e5eb);
    color: var(--whatever-muted, #667085);
    height: 36px;
    min-height: 36px;
    padding: 0;
    width: 36px;
}

.dashboard-topbar-icon:hover {
    background: var(--whatever-surface-muted, #f6f7f8);
    color: var(--whatever-ink, #1d2738);
}

.dashboard-topbar-icon.is-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.dashboard-reset-layout {
    color: var(--whatever-muted, #667085);
    min-height: 36px;
    padding: 0 12px;
}

.dashboard-reset-layout:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.dashboard-limit-text {
    color: var(--whatever-muted, #667085);
    display: none;
    font-size: 12px;
}

.dashboard-create-wrap {
    position: relative;
}

.dashboard-create-menu {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
    min-width: 280px;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1060;
}

.dashboard-create-menu[hidden] {
    display: none;
}

.dashboard-create-menu > button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #111827;
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    text-align: left;
    width: 100%;
}

.dashboard-create-menu > button:hover,
.dashboard-create-menu > button:focus {
    background: #f3f4f6;
    outline: none;
}

.dashboard-create-menu strong,
.dashboard-create-menu small {
    display: block;
}

.dashboard-create-menu strong {
    font-size: 13px;
}

.dashboard-create-menu small {
    color: #6b7280;
    font-size: 11px;
    margin-top: 2px;
}

.dashboard-menu-icon {
    align-items: center;
    background: transparent;
    border-radius: 0;
    color: #2563eb;
    display: flex;
    flex: 0 0 auto;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.dashboard-pagebar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px auto 0;
    max-width: 1600px;
    min-height: 36px;
    overflow: visible;
    padding: 0;
}

.dashboard-pages-scroll {
    align-items: center;
    display: flex;
    flex: 1 1 0;
    gap: 4px;
    margin: 0 -4px;
    min-width: 0;
    overflow-x: auto;
    padding: 0 4px;
    scrollbar-width: none;
}

.dashboard-pages-scroll::-webkit-scrollbar {
    display: none;
}

.dashboard-tabs {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    max-width: none;
    overflow: visible;
    padding: 0;
}

.dashboard-tab,
.dashboard-add-page {
    align-items: center;
    background: #fff;
    border: 1px solid var(--whatever-border, #e1e5eb);
    border-radius: 6px;
    color: var(--whatever-muted, #667085);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.dashboard-tab i {
    font-size: 14px;
}

.dashboard-tab:hover,
.dashboard-add-page:hover {
    background: var(--whatever-surface-muted, #f6f7f8);
    color: var(--whatever-ink, #1d2738);
}

.dashboard-tab.is-active {
    background: var(--whatever-primary-soft, #eef3ff);
    border-color: var(--whatever-primary, #2f66ea);
    color: var(--whatever-accent-ink, #2855b8);
}

.dashboard-tab:focus {
    outline: none;
}

.dashboard-tab:focus:not(:focus-visible) {
    box-shadow: none;
}

.dashboard-tab:focus-visible {
    box-shadow: 0 0 0 3px rgba(47, 102, 234, .18);
    outline: none;
}

.dashboard-add-page {
    background: transparent;
    border-color: transparent;
    gap: 5px;
}

.dashboard-add-page:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.dashboard-page-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.dashboard-alert {
    left: 50%;
    margin: 0;
    max-width: min(520px, calc(100vw - 24px));
    position: absolute;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    z-index: 1080;
}

/* Existing homepage charts use the same two-column card grid as Lovable. */
.dashboard-default-panel {
    background: #f5f6f8;
    min-height: 420px;
}

.dashboard-default-panel > .container-fluid {
    max-width: 1600px;
    padding: 16px 20px 60px;
}

.dashboard-default-panel #list-chart {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.dashboard-default-panel #list-chart > [id^="chart_"] {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    height: 500px !important;
    min-height: 500px;
    min-width: 0;
    overflow: hidden;
    padding: 8px;
    width: auto;
}

.dashboard-default-panel #list-chart > [id^="chart_"] .highcharts-container,
.dashboard-default-panel #list-chart > [id^="chart_"] svg {
    border-radius: 10px;
}

/* Custom chart cards */
.dashboard-custom-panel {
    background: #f5f6f8;
    margin: 0;
    min-height: 420px;
    padding: 16px 20px 60px;
}

.dashboard-grid {
    gap: 16px;
    margin: 0 auto;
    max-width: 1560px;
}

.dashboard-layout-row {
    gap: 16px;
}

.dashboard-chart-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    overflow: visible;
    transition: box-shadow .15s ease, opacity .15s ease;
}

.dashboard-chart-card:hover {
    box-shadow: 0 3px 10px rgba(15, 23, 42, .07);
}

.dashboard-card-header {
    border-bottom: 0;
    cursor: grab;
    gap: 10px;
    height: 47px;
    padding: 12px 12px 4px 14px;
}

.dashboard-card-title {
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.3;
    text-transform: uppercase;
}

.dashboard-card-meta {
    display: none;
}

.dashboard-card-actions {
    gap: 4px;
    position: relative;
}

.dashboard-icon-btn {
    border-radius: 6px;
    color: #6b7280;
    height: 28px;
    width: 28px;
}

.dashboard-icon-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.dashboard-card-menu {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .14);
    min-width: 185px;
    padding: 5px;
    position: absolute;
    right: 0;
    top: 34px;
    z-index: 15;
}

.dashboard-card-menu[hidden] {
    display: none;
}

.dashboard-card-menu button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #374151;
    display: flex;
    font-size: 12px;
    gap: 9px;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.dashboard-card-menu button:hover {
    background: #f3f4f6;
}

.dashboard-card-menu button.is-danger {
    color: #dc2626;
}

.dashboard-chart-host {
    height: calc(100% - 47px);
    padding: 0 8px 10px;
}

.dashboard-resize-handle {
    background: transparent;
    border: 0;
    border-bottom-right-radius: 10px;
    bottom: 0;
    height: 32px;
    opacity: 1;
    right: 0;
    width: 32px;
}

.dashboard-resize-handle::after {
    background:
        linear-gradient(135deg, transparent 46%, #9ca3af 46%, #9ca3af 54%, transparent 54%),
        linear-gradient(135deg, transparent 66%, #9ca3af 66%, #9ca3af 74%, transparent 74%);
    bottom: 4px;
    content: '';
    height: 14px;
    pointer-events: none;
    position: absolute;
    right: 4px;
    width: 14px;
}

.dashboard-chart-card.is-resize-preview {
    overflow: hidden;
    will-change: left, top, width, height;
}

.dashboard-insert-after {
    background: #2563eb;
    border: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}

.dashboard-empty {
    border-color: #d1d5db;
    box-shadow: none;
    margin: 48px auto;
}

/* Lovable modal shell */
.dashboard-modal .modal-dialog {
    margin: 20px auto;
    max-width: min(1120px, calc(100vw - 40px));
    width: calc(100% - 40px);
}

.dashboard-chart-modal .modal-dialog {
    height: calc(100dvh - 40px);
    max-height: 820px;
}

.dashboard-modal .modal-content {
    background: #fff;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
    max-height: 90dvh;
    overflow: hidden;
}

.dashboard-chart-modal .modal-content {
    border: 1px solid #e2e8f0;
    height: 82dvh;
    max-height: 820px;
    min-height: 620px;
}

.dashboard-modal .modal-header,
.dashboard-chart-modal-header {
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 64px;
    padding: 13px 56px 13px 18px;
    position: relative;
}

.dashboard-chart-name {
    flex: 1 1 260px;
    min-width: 180px;
}

.dashboard-chart-name input {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    height: 36px;
    max-width: 390px;
    outline: none;
    padding: 0 12px;
    width: 100%;
}

.dashboard-chart-name input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.dashboard-chart-header-actions {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.dashboard-period-pills {
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    gap: 4px;
    padding: 3px;
}

.dashboard-period-pills button {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #4b5563;
    font-size: 12px;
    font-weight: 500;
    min-width: 48px;
    padding: 6px 12px;
}

.dashboard-period-pills button.is-active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    color: #111827;
}

.dashboard-modal-close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #6b7280;
    display: flex;
    font-size: 22px;
    height: 34px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    position: absolute;
    right: 8px;
    top: 8px;
    width: 34px;
}

.dashboard-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.dashboard-chart-builder {
    background: #fff;
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.dashboard-chart-modal-loading {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    color: #334155;
    display: flex;
    flex-direction: column;
    gap: 7px;
    inset: 0;
    justify-content: center;
    position: absolute;
    text-align: center;
    z-index: 1100;
}

.dashboard-chart-modal-loading[hidden] {
    display: none;
}

.dashboard-chart-modal-loading-icon {
    align-items: center;
    background: #eff6ff;
    border-radius: 50%;
    color: #2563eb;
    display: inline-flex;
    font-size: 18px;
    height: 44px;
    justify-content: center;
    margin-bottom: 3px;
    width: 44px;
}

.dashboard-chart-modal-loading strong {
    font-size: 13px;
}

.dashboard-chart-modal-loading small {
    color: #64748b;
    font-size: 11px;
}

.dashboard-builder-left {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}

.dashboard-builder-left-head {
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    padding: 12px;
}

.dashboard-builder-left-head strong,
.dashboard-builder-left-head span {
    display: block;
}

.dashboard-builder-left-head strong {
    color: #0f172a;
    font-size: 13px;
}

.dashboard-builder-left-head span {
    color: #6b7280;
    font-size: 11px;
    margin-top: 2px;
}

.dashboard-selected-series {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.dashboard-series-empty {
    color: #9ca3af;
    font-size: 12px;
    line-height: 1.55;
    margin: auto;
    max-width: 230px;
    padding: 32px 12px;
    text-align: center;
}

.dashboard-series-item {
    align-items: center;
    background: #f9fafb;
    border: 1px solid #eef0f3;
    border-radius: 8px;
    display: grid;
    gap: 5px 7px;
    grid-template-columns: 18px minmax(0, 1fr) 28px;
    padding: 7px 6px;
}

.dashboard-series-drag {
    height: 28px;
    width: 18px;
}

.dashboard-series-drag .fa + .fa {
    margin-left: -2px;
}

.dashboard-series-name {
    font-size: 12px;
}

.dashboard-series-stock {
    background: #eff6ff;
    border-radius: 999px;
    color: #1d4ed8;
    font-size: 10px;
    padding: 2px 7px;
}

.dashboard-series-remove {
    height: 28px;
    width: 28px;
}

.dashboard-series-options {
    grid-column: 2 / 4;
    justify-content: flex-start;
}

.dashboard-series-style,
.dashboard-series-order {
    border-color: #e5e7eb;
    height: 27px;
}

.dashboard-stock-picker {
    background: #fafbfc;
    border-bottom: 1px solid #e5e7eb;
    margin: 0;
    padding: 10px 12px;
    position: relative;
}

.dashboard-stock-picker label,
.dashboard-stock-picker small {
    display: block;
}

.dashboard-stock-picker label {
    color: #4b5563;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 5px;
}

.dashboard-stock-combobox {
    position: relative;
}

.dashboard-stock-combobox > i {
    color: #9ca3af;
    font-size: 11px;
    left: 11px;
    pointer-events: none;
    position: absolute;
    top: 12px;
    z-index: 2;
}

.dashboard-stock-picker input {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #111827;
    font-size: 12px;
    height: 34px;
    padding: 0 10px 0 30px;
    text-transform: uppercase;
    width: 100%;
}

.dashboard-stock-picker input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
    outline: none;
}

.dashboard-stock-suggestions {
    background: #fff;
    border: 1px solid #dbe3ec;
    border-radius: 9px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    left: 0;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px;
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    z-index: 1085;
}

.dashboard-stock-suggestions[hidden] {
    display: none;
}

.dashboard-stock-suggestion {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #111827;
    display: grid;
    gap: 10px;
    grid-template-columns: 52px minmax(0, 1fr);
    min-height: 38px;
    padding: 6px 8px;
    text-align: left;
    width: 100%;
}

.dashboard-stock-suggestion:hover,
.dashboard-stock-suggestion:focus,
.dashboard-stock-suggestion.is-active {
    background: #eff6ff;
    outline: none;
}

.dashboard-stock-suggestion strong {
    color: #1d4ed8;
    font-size: 12px;
    letter-spacing: .02em;
}

.dashboard-stock-suggestion span {
    color: #4b5563;
    font-size: 10px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-stock-suggestion-empty {
    color: #6b7280;
    font-size: 11px;
    padding: 12px 10px;
    text-align: center;
}

.dashboard-selected-stock-name {
    color: #334155;
    display: block;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.35;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-selected-stock-name.is-missing {
    color: #9ca3af;
    font-weight: 500;
}

.dashboard-stock-picker small {
    color: #9ca3af;
    font-size: 10px;
    margin-top: 4px;
}

.dashboard-display-panel {
    background: #fafbfc;
    border-top: 1px solid #e5e7eb;
    flex: 0 0 auto;
    padding: 10px 12px;
}

.dashboard-display-panel[hidden] {
    display: none;
}

.dashboard-display-panel .dashboard-display-setting {
    justify-content: space-between;
    margin-bottom: 8px;
}

.dashboard-display-panel .dashboard-switch {
    color: #4b5563;
    font-size: 11px;
    margin: 2px 0 0;
}

.dashboard-builder-preview {
    background: #f8fafc;
    min-height: 0;
    padding: 16px;
}

.dashboard-preview-chart {
    height: 100%;
    min-height: 340px;
    width: 100%;
}

.dashboard-preview-empty {
    align-items: center;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    min-height: 340px;
    text-align: center;
}

.dashboard-preview-empty > span {
    align-items: center;
    background: #eff6ff;
    border-radius: 50%;
    color: #2563eb;
    display: flex;
    font-size: 22px;
    height: 54px;
    justify-content: center;
    margin-bottom: 12px;
    width: 54px;
}

.dashboard-preview-empty strong {
    color: #4b5563;
    font-size: 13px;
}

.dashboard-preview-empty p {
    font-size: 11px;
    margin: 5px 0 0;
}

.dashboard-chart-form-error {
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 11px;
    padding: 8px 12px;
}

.dashboard-chart-form-error[hidden] {
    display: none;
}

.dashboard-chart-footer,
.dashboard-modal .modal-footer {
    align-items: center;
    background: #fafbfc;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    min-height: 61px;
    padding: 12px 18px;
}

.dashboard-chart-footer > div {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-help-text {
    color: #6b7280;
    font-size: 11px;
}

.dashboard-chart-modal .dashboard-chart-footer {
    background: #f8fafc;
    border-top-color: #dbe3ec;
    box-shadow: 0 -1px 0 rgba(15, 23, 42, .025);
    gap: 10px;
    min-height: 54px;
    padding: 8px 16px;
}

.dashboard-chart-modal .dashboard-chart-footer button {
    font-size: 12px;
    height: 32px;
    min-height: 32px;
    padding: 5px 10px;
}

.dashboard-chart-footer .dashboard-help-text {
    flex: 1 1 260px;
    line-height: 1.3;
    padding: 0;
}

/* Indicator picker layered inside the builder, equivalent to Lovable's
   dedicated picker modal without stacking two Bootstrap modals. */
.dashboard-picker {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 10px;
    position: absolute;
    z-index: 30;
}

.dashboard-picker[hidden] {
    display: none;
}

.dashboard-picker-overlay {
    background: rgba(15, 23, 42, .48);
    border: 0;
    inset: 0;
    padding: 0;
    position: absolute;
}

.dashboard-picker-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .24);
    display: flex;
    flex-direction: column;
    height: min(700px, calc(100% - 12px));
    max-width: 1040px;
    overflow: hidden;
    position: relative;
    width: min(1040px, calc(100% - 16px));
    z-index: 1;
}

.dashboard-picker-header {
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    min-height: 44px;
    padding: 7px 50px 7px 14px;
    position: relative;
}

.dashboard-picker-header h3 {
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.dashboard-picker-header .dashboard-modal-close {
    height: 30px;
    right: 8px;
    top: 7px;
    width: 30px;
}

.dashboard-picker-body {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.dashboard-category-pane {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 8px;
}

.dashboard-pane-title {
    color: #6b7280;
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    padding: 5px 10px;
    text-transform: uppercase;
}

.dashboard-category-list {
    gap: 1px;
    margin: 2px 0 0;
}

.dashboard-category-button {
    border-radius: 6px;
    color: #374151;
    font-size: 13px;
    padding: 8px 10px;
}

.dashboard-category-button.is-active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.dashboard-metric-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}

.dashboard-metric-head {
    border-bottom: 1px solid #f3f4f6;
    flex: 0 0 auto;
    padding: 10px;
}

.dashboard-search {
    background: #fff;
    border-color: #d1d5db;
    max-width: 280px;
}

.dashboard-metric-list {
    flex: 1 1 auto;
    margin: 0;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 10px 14px;
    scrollbar-gutter: stable;
}

.dashboard-metric-row {
    align-items: flex-start;
    border: 0;
    border-radius: 6px;
    padding-bottom: 8px;
    padding-top: 8px;
}

.dashboard-metric-row:hover {
    background: #f3f4f6;
}

.dashboard-metric-row input {
    accent-color: #2563eb;
}

.dashboard-metric-name {
    color: #111827;
    font-size: 13px;
}

.dashboard-metric-unit {
    color: #9ca3af;
    font-size: 10px;
}

.dashboard-picker-footer {
    align-items: center;
    background: #f8fafc;
    border-top: 1px solid #dbe3ec;
    color: #6b7280;
    display: flex;
    flex: 0 0 auto;
    font-size: 11px;
    gap: 16px;
    justify-content: space-between;
    min-height: 46px;
    padding: 7px 14px;
    position: relative;
    z-index: 2;
}

.dashboard-picker-footer > span {
    line-height: 1.3;
    min-width: 0;
    padding-left: 2px;
}

.dashboard-picker-footer .dashboard-primary-button {
    flex: 0 0 auto;
    font-size: 11px;
    height: 30px;
    min-height: 30px;
    min-width: 68px;
    padding: 4px 10px;
}

/* Page modal and series-style popover */
#dashboard-page-modal .modal-dialog {
    max-width: 480px;
}

#dashboard-page-modal .modal-header {
    align-items: flex-start;
}

#dashboard-page-modal .modal-title {
    color: #0f172a;
    font-size: 15px;
}

#dashboard-page-modal .modal-body {
    padding: 18px;
}

#dashboard-page-modal .form-control {
    border-color: #d1d5db;
    border-radius: 8px;
    height: 38px;
}

.dashboard-style-popover {
    border-color: #e5e7eb;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
}

@media (max-width: 980px) {
    .dashboard-default-panel #list-chart {
        grid-template-columns: 1fr;
    }

    .dashboard-chart-builder {
        grid-template-columns: 290px minmax(0, 1fr);
    }

    .dashboard-topbar {
        align-items: flex-start;
    }

    .dashboard-crumbs {
        max-width: 44vw;
    }
}

@media (max-width: 767.98px) {
    .dashboard-builder {
        margin: 0;
        padding: 18px 12px 0;
    }

    .dashboard-section-head h1 {
        font-size: 18px;
    }

    .dashboard-section-head p {
        font-size: 13px;
        max-width: 560px;
    }

    .dashboard-reset-layout {
        min-width: 34px;
        padding: 0;
        width: 36px;
    }

    .dashboard-reset-layout > span {
        display: none;
    }

    .dashboard-crumbs {
        font-size: 11px;
        max-width: calc(100vw - 164px);
    }

    .dashboard-primary-button {
        height: 36px;
        min-width: 36px;
        padding: 0 10px;
    }

    .dashboard-create-menu {
        max-width: calc(100vw - 24px);
        min-width: 284px;
        position: absolute;
        right: 0;
        top: calc(100% + 8px);
    }

    .dashboard-pagebar {
        flex-wrap: nowrap;
        margin-top: 14px;
        padding: 0;
    }

    .dashboard-tabs {
        flex: 0 0 auto;
        max-width: none;
    }

    .dashboard-add-page span {
        display: inline;
    }

    .dashboard-page-actions {
        gap: 6px;
    }

    .dashboard-page-actions .dashboard-primary-button > span {
        display: none;
    }

    .dashboard-default-panel > .container-fluid,
    .dashboard-custom-panel {
        padding: 10px 8px 36px;
    }

    .dashboard-default-panel #list-chart {
        gap: 10px;
    }

    .dashboard-default-panel #list-chart > [id^="chart_"] {
        height: 440px !important;
        min-height: 440px;
        padding: 4px;
    }

    .dashboard-custom-panel {
        margin: 0;
    }

    .dashboard-grid,
    .dashboard-layout-row {
        gap: 10px;
    }

    .dashboard-layout-row {
        min-height: 440px;
    }

    .dashboard-card-header {
        cursor: default;
    }

    .dashboard-resize-handle {
        cursor: ns-resize;
        height: 40px;
        width: 40px;
    }

    body.dashboard-is-resizing,
    body.dashboard-is-resizing * {
        cursor: ns-resize !important;
    }

    .dashboard-chart-modal .modal-dialog,
    .dashboard-modal .modal-dialog {
        height: 100dvh;
        margin: 0;
        max-height: none;
        max-width: none;
        width: 100%;
    }

    .dashboard-chart-modal .modal-content,
    .dashboard-modal .modal-content {
        border: 0;
        border-radius: 0;
        height: 100dvh;
        max-height: none;
        min-height: 0;
    }

    .dashboard-chart-modal-header {
        align-items: stretch;
        display: grid;
        gap: 8px;
        grid-template-columns: minmax(0, 1fr);
        padding: 10px 50px 10px 12px;
    }

    .dashboard-chart-name {
        min-width: 0;
    }

    .dashboard-chart-name input {
        max-width: none;
    }

    .dashboard-chart-header-actions {
        justify-content: space-between;
        margin: 0;
    }

    .dashboard-period-pills {
        flex: 1 1 auto;
    }

    .dashboard-period-pills button {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
    }

    .dashboard-chart-builder {
        display: block;
        overflow-y: auto;
    }

    .dashboard-builder-left {
        border: 0;
        min-height: 300px;
    }

    .dashboard-selected-series {
        max-height: 280px;
        min-height: 170px;
    }

    .dashboard-builder-preview {
        border-top: 1px solid #e5e7eb;
        height: 390px;
        padding: 10px 6px;
    }

    .dashboard-preview-chart,
    .dashboard-preview-empty {
        min-height: 360px;
    }

    .dashboard-picker {
        padding: 0;
        position: fixed;
    }

    .dashboard-picker-panel {
        border: 0;
        border-radius: 0;
        height: 100dvh;
        max-width: none;
        width: 100%;
    }

    .dashboard-picker-body {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .dashboard-category-pane {
        border-bottom: 1px solid #e5e7eb;
        border-right: 0;
        flex: 0 0 auto;
        max-height: 132px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 7px;
    }

    .dashboard-category-list {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
    }

    .dashboard-category-button {
        flex: 0 0 auto;
    }

    .dashboard-metric-pane {
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }

    .dashboard-metric-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-search {
        max-width: none;
        width: 100%;
    }

    .dashboard-metric-list {
        -webkit-overflow-scrolling: touch;
        min-height: 0;
        overscroll-behavior: contain;
        overflow-y: auto;
        padding: 8px 12px 16px 10px;
    }

    .dashboard-picker-footer {
        padding: 7px 14px;
        padding-bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    }

    .dashboard-chart-modal .dashboard-chart-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 5px;
        min-height: 0;
        padding: 8px 12px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .dashboard-chart-footer > div {
        justify-content: flex-end;
    }

    .dashboard-chart-modal .dashboard-chart-footer button {
        min-height: 32px;
        padding: 5px 9px;
    }

    .dashboard-style-popover {
        bottom: 8px !important;
        left: 8px !important;
        right: 8px !important;
        top: auto !important;
    }
}

@media (max-width: 430px) {
    .dashboard-topbar-left {
        gap: 9px;
    }

    #dashboard-industry-crumb,
    .dashboard-crumb-separator {
        display: none;
    }

    .dashboard-topbar-icon {
        height: 32px;
        min-height: 32px;
        width: 30px;
    }

    .dashboard-builder-left-head {
        align-items: flex-start;
        flex-direction: column;
    }

    #dashboard-open-picker {
        width: 100%;
    }

    .dashboard-display-toggle {
        padding-left: 7px;
        padding-right: 7px;
    }

    .dashboard-help-text {
        display: none;
    }

    .dashboard-chart-footer > div,
    .dashboard-chart-footer button {
        flex: 1 1 0;
    }
}

/* The existing homepage charts form the immutable default tab. Keep their
   Bootstrap layout and visual options; dashboard JS only adds the requested
   height increment before Highcharts creates them. */
.dashboard-default-panel {
    background: transparent;
    min-height: 0;
}

.dashboard-default-panel > .container-fluid {
    max-width: none;
    padding-bottom: 0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 0;
}

.dashboard-default-panel #list-chart {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-left: -15px;
    margin-right: -15px;
}

.dashboard-default-panel #list-chart > [id^="chart_"] {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    height: auto !important;
    min-height: 0;
    overflow: visible;
    padding-bottom: 0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 0;
}

.dashboard-default-panel #list-chart > [id^="chart_"] .highcharts-container,
.dashboard-default-panel #list-chart > [id^="chart_"] svg {
    border-radius: 0;
}

/* Highcharts creates transparent HTML buttons over legend items. Remove the
   native pointer-focus ring, then use one rectangular blue selection surface
   regardless of whether the legend text wraps onto two lines. */
.dashboard-default-panel .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip,
.dashboard-custom-panel .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip,
.dashboard-focus-modal .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip,
.dashboard-chart-modal .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip {
    -webkit-appearance: none !important;
    appearance: none !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: transparent !important;
    opacity: .001 !important;
    outline: none !important;
    padding: 0 !important;
}

.dashboard-default-panel .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus,
.dashboard-custom-panel .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus,
.dashboard-focus-modal .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus,
.dashboard-chart-modal .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus {
    background: rgba(37, 99, 235, .12) !important;
    border-radius: 4px !important;
    opacity: 1 !important;
}

.dashboard-default-panel .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus-visible,
.dashboard-custom-panel .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus-visible,
.dashboard-focus-modal .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus-visible,
.dashboard-chart-modal .highcharts-a11y-proxy-group-legend button.highcharts-a11y-proxy-element.highcharts-no-tooltip:focus-visible {
    border-radius: 4px !important;
    box-shadow: 0 0 0 2px #2563eb !important;
    opacity: 1 !important;
}

.dashboard-default-panel .highcharts-focus-border,
.dashboard-custom-panel .highcharts-focus-border,
.dashboard-focus-modal .highcharts-focus-border,
.dashboard-chart-modal .highcharts-focus-border {
    display: none !important;
}

/* Keep a clear, rectangular selected state even when a metric name wraps. */
.dashboard-metric-row.is-selected,
.dashboard-metric-row:focus-within,
.dashboard-metric-row.is-parent.is-selected {
    background: #eaf2ff;
    box-shadow: inset 0 0 0 1px #93c5fd;
}

.dashboard-metric-row.is-selected:hover,
.dashboard-metric-row.is-parent.is-selected:hover {
    background: #dbeafe;
}

.dashboard-metric-row.is-selected .dashboard-metric-name,
.dashboard-metric-row:focus-within .dashboard-metric-name {
    color: #1d4ed8;
}

.dashboard-series-item.is-active {
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12);
}

.dashboard-series-item.is-active .dashboard-series-name,
.dashboard-series-style.is-active {
    color: #1d4ed8;
}

.dashboard-series-item.is-active .dashboard-series-style {
    background: #dbeafe;
    border-color: #93c5fd;
}

.dashboard-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* Collision-aware custom layout. Cards use persisted 12-column x/y geometry;
   vertical growth only moves cards whose horizontal ranges actually overlap. */
.dashboard-custom-panel .dashboard-grid {
    display: block;
    gap: 0;
    min-height: 0;
    position: relative;
}

.dashboard-custom-panel .dashboard-chart-card {
    grid-column: auto;
    position: absolute;
}

@media (max-width: 767.98px) {
    .dashboard-custom-panel .dashboard-grid {
        display: block;
    }
}

/* Focused chart viewer. This intentionally remains a centered, large dialog
   dialog instead of invoking the browser's native full-screen mode. */
.dashboard-focus-modal .modal-dialog {
    margin: 18px auto;
    max-width: 1320px;
    width: calc(100% - 40px);
}

.dashboard-focus-modal .modal-content {
    background: #fff;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    height: min(860px, 88vh);
    height: min(860px, 88dvh);
    min-height: 620px;
    overflow: hidden;
}

.dashboard-focus-header {
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    flex: 0 0 auto;
    gap: 18px;
    grid-template-columns: minmax(190px, 1fr) auto minmax(40px, 1fr);
    min-height: 76px;
    padding: 12px 52px;
    position: relative;
}

.dashboard-focus-heading {
    align-items: center;
    display: flex;
    gap: 10px;
    min-width: 0;
}

.dashboard-focus-icon {
    align-items: center;
    background: #eff6ff;
    border-radius: 9px;
    color: #2563eb;
    display: inline-flex;
    flex: 0 0 auto;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.dashboard-focus-heading h3,
#dashboard-focus-meta {
    display: block;
    margin: 0;
}

.dashboard-focus-heading h3 {
    color: #111827;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.3;
    max-width: 310px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#dashboard-focus-meta {
    color: #6b7280;
    font-size: 11px;
    line-height: 1.35;
    margin-top: 2px;
}

.dashboard-focus-controls,
.dashboard-focus-control-group {
    align-items: center;
    display: flex;
    justify-content: center;
}

.dashboard-focus-controls {
    gap: 18px;
    grid-column: 2;
    justify-self: center;
}

.dashboard-focus-control-group {
    gap: 8px;
    margin: 0;
}

.dashboard-focus-control-label {
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
    line-height: 36px;
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

.dashboard-focus-periods {
    align-items: center;
    background: #f3f4f6;
    border-radius: 8px;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    padding: 3px;
}

.dashboard-focus-periods button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #4b5563;
    display: inline-flex;
    font-size: 12px;
    font-weight: 600;
    height: 30px;
    justify-content: center;
    min-width: 50px;
    padding: 0 11px;
}

.dashboard-focus-periods button:hover,
.dashboard-focus-periods button:focus {
    color: #1d4ed8;
    outline: none;
}

.dashboard-focus-periods button.is-active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
    color: #1d4ed8;
}

#dashboard-focus-points {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #111827;
    font-size: 13px;
    font-weight: 600;
    height: 36px;
    line-height: 34px;
    padding: 0 7px;
    text-align: center;
    width: 66px;
}

#dashboard-focus-points:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    outline: none;
}

.dashboard-focus-save {
    height: 36px;
    min-height: 36px;
    min-width: 66px;
    padding: 6px 13px;
}

.dashboard-focus-save:disabled {
    background: #cbd5e1;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: default;
}

.dashboard-focus-close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #6b7280;
    display: flex;
    font-size: 24px;
    height: 36px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    position: absolute;
    right: 10px;
    top: 10px;
    width: 36px;
}

.dashboard-focus-close:hover,
.dashboard-focus-close:focus {
    background: #f3f4f6;
    color: #111827;
    outline: none;
}

.dashboard-focus-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 16px 16px;
}

.dashboard-focus-chart {
    height: 100%;
    min-height: 0;
    width: 100%;
}

.dashboard-focus-state {
    align-items: center;
    color: #64748b;
    display: flex;
    flex-direction: column;
    font-size: 13px;
    gap: 9px;
    height: 100%;
    justify-content: center;
    min-height: 360px;
    text-align: center;
}

.dashboard-focus-state i {
    color: #2563eb;
    font-size: 20px;
}

.dashboard-focus-state.is-error {
    color: #b91c1c;
}

@media (max-width: 1119.98px) {
    .dashboard-focus-modal .modal-dialog {
        margin: 10px auto;
        width: calc(100% - 20px);
    }

    .dashboard-focus-modal .modal-content {
        height: min(820px, 90vh);
        height: min(820px, 90dvh);
        min-height: 520px;
    }

    .dashboard-focus-header {
        gap: 10px;
        grid-template-columns: minmax(0, 1fr);
        padding: 12px 48px;
    }

    .dashboard-focus-heading {
        justify-content: center;
        text-align: center;
    }

    .dashboard-focus-controls {
        flex-wrap: wrap;
        gap: 8px 14px;
        grid-column: 1;
        width: 100%;
    }
}

@media (max-width: 520px) {
    .dashboard-focus-modal .modal-dialog {
        margin: 8px auto;
        width: calc(100% - 16px);
    }

    .dashboard-focus-modal .modal-content {
        height: min(720px, 92vh);
        height: min(720px, 92dvh);
        min-height: 480px;
    }

    .dashboard-focus-control-group {
        flex: 1 1 100%;
    }

    .dashboard-focus-body {
        padding: 8px 8px 12px;
    }
}

@media (max-height: 640px) {
    .dashboard-focus-modal .modal-content {
        height: calc(100vh - 32px);
        height: calc(100dvh - 32px);
        min-height: 0;
    }

    .dashboard-focus-state {
        min-height: 0;
    }
}

/* Keep the create/edit chart dialog compact. Only the nested metric picker
   temporarily expands it; the focused-chart viewer has its own sizing above. */
@media (min-width: 992px) {
    #dashboard-chart-modal .modal-dialog {
        height: auto;
        margin: 24px auto;
        max-height: none;
        max-width: 980px;
        width: min(980px, calc(100vw - 48px));
    }

    #dashboard-chart-modal .modal-content {
        height: clamp(560px, 70dvh, 650px);
        max-height: calc(100dvh - 48px);
        min-height: 0;
    }

    #dashboard-chart-modal.is-picker-open .modal-dialog {
        margin: 20px auto;
        max-width: 1120px;
        width: min(1120px, calc(100vw - 40px));
    }

    #dashboard-chart-modal.is-picker-open .modal-content {
        height: min(820px, calc(100dvh - 40px));
        max-height: calc(100dvh - 40px);
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    #dashboard-chart-modal .modal-dialog {
        height: auto;
        margin: 16px auto;
        max-height: none;
        max-width: 920px;
        width: calc(100vw - 32px);
    }

    #dashboard-chart-modal .modal-content {
        height: min(620px, calc(100dvh - 32px));
        max-height: calc(100dvh - 32px);
        min-height: 0;
    }

    #dashboard-chart-modal .dashboard-chart-builder {
        grid-template-columns: 290px minmax(0, 1fr);
    }

    #dashboard-chart-modal.is-picker-open .modal-content {
        height: min(760px, calc(100dvh - 32px));
    }
}

/* Do not expose the server-rendered default page while the saved page is
   being resolved. Visibility keeps Highcharts measurable during bootstrap. */
.dashboard-panel-pending {
    visibility: hidden;
}

.dashboard-bootstrap-status {
    align-items: center;
    color: #64748b;
    display: none;
    font-size: 14px;
    gap: 8px;
    margin: 14px auto 0;
    max-width: 1600px;
    min-height: 40px;
    padding: 0 20px;
}

.dashboard-builder.is-booting .dashboard-bootstrap-status {
    display: flex;
}

.dashboard-builder.is-booting .dashboard-pagebar {
    display: none;
}
