/* styles-dashboard.css: Dashboard and Analytics. Uses the tokens from styles.css and styles-business.css. */

/* ---------- attention strip ---------- */
.attn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; margin-bottom: 14px; }
.attn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; }
a.attn:hover { border-color: var(--accent); }
.attn > .icon:last-child { margin-left: auto; color: var(--muted); }
.attn-ic { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.attn-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }
.attn-text b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.attn-zero .attn-ic { background: var(--surface-2); color: var(--muted); }
.attn-zero b { color: var(--muted); }
.attn-warn { border-color: rgba(232, 163, 23, 0.5); }
.attn-warn .attn-ic { background: var(--warn-soft); color: var(--warn); }
.attn-error { border-color: rgba(229, 72, 77, 0.5); background: var(--danger-soft); }
.attn-error .attn-ic { background: transparent; color: var(--danger); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-bottom: 8px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; }
.kpi-link:hover { border-color: var(--accent); }
.kpi-link > .icon:last-child { position: absolute; right: 12px; top: 14px; color: var(--muted); }
.kpi-err { border-color: rgba(229, 72, 77, 0.5); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 550; color: var(--muted); padding-right: 22px; }
.kpi-tip { display: inline-flex; color: var(--muted); cursor: help; border-radius: 50%; }
.kpi-value { font-size: 1.7rem; font-weight: 650; line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-sub, .kpi-note { overflow-wrap: anywhere; }
.kpi-delta-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 2px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-delta-up { color: var(--success); }
.kpi-delta-down { color: var(--danger); }
.kpi-delta-flat { color: var(--muted); }
.kpi-spark { margin-top: 6px; }
.kpi-spark .biz-spark { height: 32px; width: 100%; margin-top: 0; }
.kpi-soft-err { color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.kpi-soft-err .icon { color: var(--warn); }
.dash-foot { margin: 0 0 18px; max-width: 90ch; }

/* ---------- two columns ---------- */
.dash-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; min-width: 0; }
.dash-card { margin-bottom: 16px; }
.dash-col .dash-card:last-child { margin-bottom: 0; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-title-row .card-title { margin-bottom: 12px; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: minmax(0, 1fr); } .dash-col .dash-card:last-child { margin-bottom: 16px; } }

/* ---------- retention summary ---------- */
.ret-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 12px; }
.ret-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; min-width: 0; }
.ret-val { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; }
.feed-item { border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-link { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; color: var(--text); text-decoration: none; border-radius: 8px; }
.feed-link:hover { background: var(--surface-2); }
.feed-ic { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.feed-user { color: var(--info); background: var(--info-soft); }
.feed-lead { color: var(--accent); background: var(--accent-soft); }
.feed-message { color: var(--warn); background: var(--warn-soft); }
.feed-audit { color: var(--success); background: var(--success-soft); }
.feed-text { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.feed-title { font-size: 0.9rem; }
.feed-time { flex: none; white-space: nowrap; }

/* ---------- content health ---------- */
.col-gap { display: flex; flex-direction: column; gap: 12px; }
.meter-row { display: flex; flex-direction: column; gap: 4px; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.88rem; }
.meter { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- analytics ---------- */
.an-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.an-basis { margin: -4px 0 12px; max-width: 90ch; }
.an-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.an-toolbar p { margin: 0; }
.heat-wrap { margin-bottom: 8px; }
.heat { min-width: 560px; }
.heat th, .heat td { text-align: center; }
.heat th:first-child, .heat tbody th { text-align: left; white-space: nowrap; font-weight: 500; }
.heat .num { text-align: right; }
.heat-cell { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.85rem; padding: 8px 6px; border: 2px solid var(--surface); min-width: 52px; }
.heat-empty { background: var(--surface-2); }
.heat-partial { font-style: italic; }
.heat-h { white-space: nowrap; }
.an-note-list { margin: 6px 0 0; padding-left: 18px; }

@media (max-width: 480px) {
  .kpi-value { font-size: 1.45rem; }
  .ret-row { grid-template-columns: minmax(0, 1fr); }
  .page-actions { width: 100%; }
}
.an-tabs .tablist { overflow-y: hidden; }
