/* Configurable dashboards (ADR-0002) — ported from Aedium's app.css dashboard rules.
   Class names kept as `aed-dashboard-*` so dashboard-grid.js (drag handle =
   .aed-dashboard-cell-header) stays byte-identical and diffable against Aedium. */

.aed-dashboard-grid-wrap { width: 100%; min-height: 200px; }

/* GridStack-offline CSS-Grid fallback. When the vendored gridstack.min.css is missing,
   this lays out cells via inline grid-column/grid-row. When GridStack loads it switches
   the items to position:absolute and this stops mattering — both paths work. */
.aed-dashboard-grid-wrap .grid-stack {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: minmax(0, auto);
    gap: 8px;
    align-items: stretch;
}

/* Edit-mode affordances on the drag area (.grid-stack-item-content). */
.aed-dashboard-grid-wrap.is-edit .grid-stack-item > .grid-stack-item-content {
    outline: 2px dashed rgba(99, 102, 241, 0.55);
    outline-offset: -2px;
    transition: outline-color 0.12s ease, box-shadow 0.12s ease;
}
.aed-dashboard-grid-wrap.is-edit .grid-stack-item > .grid-stack-item-content:hover {
    outline-color: rgba(99, 102, 241, 0.9);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.18);
}
.aed-dashboard-grid-wrap.is-edit .grid-stack-item > .ui-resizable-se {
    width: 22px; height: 22px; right: 2px; bottom: 2px;
    background-color: rgba(99, 102, 241, 0.85);
    border: 1px solid rgba(67, 56, 202, 1);
    border-radius: 4px; z-index: 100; cursor: se-resize;
}
.aed-dashboard-grid-wrap.is-edit .grid-stack-item > .ui-resizable-se:hover {
    background-color: rgba(67, 56, 202, 1); transform: scale(1.12);
}
/* Whole cell is the drag handle in edit mode (dashboard-grid.js handle = .grid-stack-item-content). */
.aed-dashboard-grid-wrap.is-edit .grid-stack-item-content { cursor: grab; }
.aed-dashboard-grid-wrap.is-edit .grid-stack-item-content:active { cursor: grabbing; }
/* Make the live widget BODY inert while designing: clicks can't fire its links/buttons (which would navigate
   away and lose unsaved layout edits), and a drag over the body just moves the cell. View mode stays interactive. */
.aed-dashboard-grid-wrap.is-edit .aed-dashboard-cell-body,
.aed-dashboard-grid-wrap.is-edit .aed-dashboard-cell-body--chromeless { pointer-events: none; }

/* Cell shell. */
.aed-dashboard-cell {
    display: flex; flex-direction: column; height: 100%; width: 100%;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); overflow: hidden;
}
.aed-dashboard-cell-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-bottom: 1px solid #f1f5f9; background: #f8fafc;
    font-size: 13px; font-weight: 600; color: #1f2937; flex: 0 0 auto;
}
.aed-dashboard-cell-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.aed-dashboard-cell-body { flex: 1 1 auto; padding: 12px; overflow: auto; min-height: 0; }

.aed-dashboard-cell-status {
    flex: 0 0 auto; padding: 2px 8px; border-radius: 9999px;
    font-size: 10px; font-weight: 600; white-space: nowrap; margin-left: 8px;
}
.aed-dashboard-cell-status--ok      { background: #dcfce7; color: #166534; }
.aed-dashboard-cell-status--warn    { background: #fef3c7; color: #92400e; }
.aed-dashboard-cell-status--danger  { background: #fee2e2; color: #991b1b; }
.aed-dashboard-cell-status--info    { background: #dbeafe; color: #1e40af; }
.aed-dashboard-cell-status--accent  { background: #fed7aa; color: #9a3412; }
.aed-dashboard-cell-status--gray    { background: #e5e7eb; color: #374151; }

/* Chromeless cells (title-divider): no card shell, content sits flat. */
.aed-dashboard-cell--chromeless { height: 100%; width: 100%; background: transparent; }
.aed-dashboard-cell-body--chromeless { height: 100%; width: 100%; }

.aed-dashboard-cell-error { font-size: 12px; color: #92400e; font-style: italic; }

/* Selection (edit mode). */
.aed-dashboard-grid-wrap.is-edit .grid-stack-item > .grid-stack-item-content.is-selected {
    outline: 2px solid #4338ca; box-shadow: 0 2px 10px rgba(67, 56, 202, 0.28);
}
.aed-dashboard-cell-selected-pill {
    flex: 0 0 auto; margin-left: 8px; padding: 1px 7px; border-radius: 9999px;
    font-size: 9px; font-weight: 700; background: #4338ca; color: #fff; text-transform: uppercase;
}

/* FeatureLinkWidget — body fills the cell (scrolls), CTA floats bottom-right. */
.aed-feature-link { position: relative; height: 100%; overflow: hidden; }
.aed-feature-link-body { height: 100%; overflow-y: auto; line-height: 1.4; padding-bottom: 40px; }
.aed-feature-link::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.92) 70%, rgba(255,255,255,1) 100%);
    pointer-events: none; z-index: 1;
}
.aed-feature-link-footer { position: absolute; right: 0; bottom: 0; z-index: 2; }
.aed-feature-link-cta {
    display: inline-block; padding: 6px 12px; border-radius: 4px;
    background: #8a5a2b; color: #fff !important; font-size: 12px; font-weight: 600;
    text-decoration: none; white-space: nowrap;
}
.aed-feature-link-cta:hover { background: #a06a33; text-decoration: none; }

/* Customize-mode toolbar buttons. */
.aed-cust-btn {
    font-size: 12px; font-weight: 500; line-height: 1.2; padding: 5px 10px;
    border: 1px solid #d1d5db; border-radius: 5px; background: #fff; color: #374151;
    cursor: pointer; white-space: nowrap;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.aed-cust-btn:hover:not(:disabled) { background: #f3f4f6; border-color: #9ca3af; color: #111827; }
.aed-cust-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.aed-cust-btn--primary { background: #8a5a2b; border-color: #8a5a2b; color: #fff; }
.aed-cust-btn--primary:hover:not(:disabled) { background: #a06a33; border-color: #a06a33; color: #fff; }
.aed-cust-btn--danger { color: #b91c1c; border-color: #fecaca; background: #fff; }
.aed-cust-btn--danger:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }

/* Full-bleed canvas (#9): two things cap the width on wide screens — (a) MainLayout's article side padding
   (2rem left / 1.5rem right, see MainLayout.razor.css ".top-row, article"), and (b) the global reading-width
   cap on .ziggis-content (app.css: max-width 1280px + margin auto, which CENTERS content and leaves big gaps
   on large monitors). The negative margins below cancel (a); the :has() rule cancels (b) ONLY for dashboard
   pages (other pages keep the comfortable 1280px reading width). */
.ziggis-content:has(.aed-dashboard-page) {
    max-width: none;
    margin: 0;
}
.aed-dashboard-page {
    margin-left: -2rem;
    margin-right: -1.5rem;
    padding: 2px 14px 8px 14px;
}

/* Single slim title bar (#9): the section name + a thin brown accent rule. The section already shows in the
   top-bar breadcrumb, so keep this low-profile (smaller h1, 1px rule, tighter spacing) — not a bulky banner —
   with the Customize toolbar pinned right, just above where the widgets start. */
.aed-dashboard-header {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    border-bottom: 1px solid rgba(138, 90, 43, 0.4);
    padding-bottom: 4px; margin-bottom: 10px;
}
.aed-dashboard-header h1 { margin: 0; font-size: 17px; font-weight: 700; color: #1f2937; letter-spacing: -0.01em; }
.aed-dashboard-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.aed-dashboard-source { font-size: 12px; color: #6b7280; }

/* Floating move/resize toolbar (edit mode, selected cell). */
.aed-dashboard-floating-toolbar {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 1200;
    display: flex; align-items: center; gap: 6px; padding: 8px 12px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.aed-dashboard-cell-coord { font-size: 11px; color: #6b7280; margin: 0 6px; }
.aed-dashboard-cell-nudge {
    width: 28px; height: 28px; border: 1px solid #d1d5db; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: 13px; line-height: 1; color: #374151;
}
.aed-dashboard-cell-nudge:hover:not(:disabled) { background: #f3f4f6; }
.aed-dashboard-cell-nudge:disabled { opacity: 0.4; cursor: not-allowed; }

/* Widget picker gallery cards. */
.aed-widget-pick-module { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #9ca3af; margin: 12px 0 6px; }

/* Widget picker card (owner 2026-07-18): kind glyph + bold title line, full-width desc, dims footer. */
.wpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.wpick-card {
    display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px;
    border: 1px solid var(--mud-palette-lines-default, #e5e7eb); border-radius: 8px;
    background: var(--mud-palette-surface, #fff); cursor: pointer;
    transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.wpick-card:hover { border-color: #8a5a2b; background: #fbf7f2; box-shadow: 0 2px 10px rgba(60, 45, 25, .09); }
.wpick-top { display: flex; align-items: center; gap: 9px; }
.wpick-glyph { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 7px;
               display: inline-flex; align-items: center; justify-content: center; }
.wpick-glyph svg { width: 18px; height: 18px; }
.wpick-glyph--chart   { background: color-mix(in srgb, #3b82f6 15%, transparent); color: #2563eb; }
.wpick-glyph--table   { background: color-mix(in srgb, #16a34a 15%, transparent); color: #15803d; }
.wpick-glyph--counter { background: color-mix(in srgb, #b45309 16%, transparent); color: #b45309; }
.wpick-glyph--link    { background: color-mix(in srgb, #8b5cf6 15%, transparent); color: #7c3aed; }
.wpick-glyph--divider { background: rgba(0, 0, 0, .06); color: #6b7280; }
.wpick-title { font-size: 13.5px; font-weight: 700; line-height: 1.25;
               color: var(--mud-palette-text-primary, #1f2937); }
.wpick-desc { font-size: 11.5px; line-height: 1.4; color: var(--mud-palette-text-secondary, #6b7280); }
.wpick-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px;
              margin-top: auto; padding-top: 2px; }
.wpick-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #9ca3af; }
.wpick-dims { font-size: 11px; color: #9ca3af; font-variant-numeric: tabular-nums; }

/* ---- Chart primitives (ported from Aedium ADR-0021) — pure SVG/CSS, no JS lib ---- */
.aed-chart-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; display: flex; flex-direction: column; height: 100%; }
.aed-chart-card-header { padding: 8px 14px; border-bottom: 1px solid #f1f5f9; background: #f8fafc; flex: 0 0 auto; }
.aed-chart-card-title { font-size: 12px; font-weight: 600; color: #374151; text-transform: uppercase; letter-spacing: 0.4px; }
.aed-chart-card-subtitle { font-size: 11px; color: #9ca3af; margin-left: 8px; }
.aed-chart-empty { padding: 18px; text-align: center; color: #9ca3af; font-size: 12px; }

/* KPI card */
.aed-kpi-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; border-left: 3px solid var(--aed-kpi-accent, #8a5a2b); height: 100%; display: flex; flex-direction: column; justify-content: center; }
.aed-kpi-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: rgba(0,0,0,0.55); }
.aed-kpi-card-value { font-size: 28px; font-weight: 700; color: #0f172a; margin-top: 4px; line-height: 1; letter-spacing: -0.4px; }
.aed-kpi-card-subtitle { font-size: 11px; color: #6b7280; margin-top: 3px; }
.aed-kpi-card-delta { font-size: 11px; margin-top: 4px; }
.aed-kpi-card-delta.positive { color: #16a34a; }
.aed-kpi-card-delta.negative { color: #dc2626; }

/* Donut */
.aed-donut { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: center; padding: 12px 14px; }
.aed-donut-svg { width: 130px; height: 130px; }
.aed-donut-total { font-size: 16px; font-weight: 700; fill: rgba(0,0,0,0.85); }
.aed-donut-total-label { font-size: 7px; fill: rgba(0,0,0,0.45); text-transform: uppercase; letter-spacing: 0.5px; }
.aed-donut-legend { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.aed-donut-legend-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.aed-donut-legend-swatch { width: 12px; height: 12px; border-radius: 3px; }
.aed-donut-legend-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; }
.aed-donut-legend-value { color: rgba(0,0,0,0.6); font-variant-numeric: tabular-nums; white-space: nowrap; }
.aed-donut-legend-pct { color: rgba(0,0,0,0.4); margin-left: 4px; }

/* Horizontal bar series */
.aed-bar-series { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.aed-bar-row { display: grid; grid-template-columns: 116px 1fr 84px; gap: 8px; align-items: center; }
.aed-bar-row-label { font-size: 12px; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aed-bar-row-track { height: 14px; background: #f0f2f4; border-radius: 3px; overflow: hidden; }
.aed-bar-row-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.aed-bar-row-value { font-size: 12px; color: #6b7280; text-align: right; font-variant-numeric: tabular-nums; }

.aed-sparkline { display: block; }
