.project-dashboard {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30%, 1fr));
    /* Tall enough for a header, a plottable chart and the footer; a chart squeezed below this
       renders its axes on top of its own labels. */
    grid-auto-rows: minmax(13em, 19em);
    gap: 1em;
    align-items: stretch;
}

/* The card chrome comes from the shared library Card; only the widget's own
   body, footer and the add tile are styled here. */
.project-chart-card {
    min-width: 0;
    /* Fill the grid cell and keep the chart inside it. Without a bounded height the chart's own
       100% resolves against nothing and it draws over the row beneath. */
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Card's body is already a flex column; this lets it take the height left over after the header
   so the chart has something definite to fill, and the footer stays in the card. */
.project-chart-card > .wc-ui-card-body {
    flex: 1;
    min-height: 0;
}

.project-chart-card-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.project-chart-card-note {
    text-align: center;
    color: var(--po-text-light, var(--nwc-ui-text-muted));
    font-size: 0.9rem;
}

.project-chart-card-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding-block-start: 0.5rem;
    border-block-start: 1px solid var(--nwc-ui-border);
    color: var(--nwc-ui-text-muted);
    font-size: 0.75rem;
    min-width: 0;
}

.project-chart-card-source {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-chart-card-updated {
    white-space: nowrap;
}

.chart-single-value {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
}

.chart-single-value-label {
    color: var(--nwc-ui-text-muted);
    font-size: 0.85rem;
}

.chart-single-value-value {
    color: var(--nwc-ui-text);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

/* Add tile: a dashed placeholder that sits in the grid so an empty board still
   shows where to start. */
.project-dashboard-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 1em;
    border: 1px dashed var(--nwc-ui-border-strong);
    border-radius: 18px;
    background: transparent;
    color: var(--nwc-ui-text-muted);
    cursor: pointer;
    text-align: center;
    transition: background 120ms ease, border-color 120ms ease;
}

.project-dashboard-add:hover {
    background: var(--nwc-ui-surface-muted);
    border-color: var(--nwc-ui-primary);
}

.project-dashboard-add:focus-visible {
    outline: 2px solid var(--nwc-ui-primary);
    outline-offset: 2px;
}

.project-dashboard-add-title {
    color: var(--nwc-ui-text);
    font-size: 0.95rem;
    font-weight: 600;
}

.project-dashboard-add-hint {
    font-size: 0.8rem;
}

/* Editor dialog: form on the left, live preview on the right. Stacks on narrow
   viewports so the preview never squeezes the form. */
.project-widget-editor {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 60rem) {
    .project-widget-editor {
        grid-template-columns: minmax(0, 1fr);
    }
}

.project-widget-editor-error {
    color: var(--nwc-ui-danger);
    font-size: 0.8rem;
    min-height: 1rem;
}

.project-widget-editor-note {
    color: var(--nwc-ui-text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.project-widget-editor-preview-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.project-widget-editor-preview-heading {
    color: var(--nwc-ui-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.project-widget-editor-preview {
    min-height: 14rem;
    display: flex;
}

.project-widget-editor-preview > * {
    flex: 1;
    min-width: 0;
}

/* View dialog body gives the chart and the grid room to fill the wide modal. */
.project-widget-view-body {
    min-height: 24rem;
    display: flex;
    flex-direction: column;
}

.project-widget-view-body > * {
    flex: 1;
    min-height: 0;
}
