/* Dashboard feature styles. Global filter styles live in components/form.css. */
@layer features {
  .cx-dashboard-kpis { margin-block-end: var(--cx-space-5); grid-auto-rows: 1fr; }
  .cx-dashboard-kpis .cx-kpi { cursor: pointer; transition: transform var(--cx-transition), box-shadow var(--cx-transition), border-color var(--cx-transition); }
  .cx-dashboard-kpis .cx-kpi:hover { transform: translateY(-2px); box-shadow: var(--cx-shadow-card); }

  .cx-hour-strip {
    display: flex;
    align-items: end;
    gap: .75rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .75rem .15rem .95rem;
    min-block-size: 142px;
    scroll-snap-type: x proximity;
  }
  .cx-hour-strip::-webkit-scrollbar { block-size: 8px; }
  .cx-hour-strip::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--cx-brand-accent) 28%, var(--cx-border)); border-radius: 999px; }
  .cx-hour-block {
    flex: 0 0 76px;
    min-block-size: 124px;
    display: grid;
    gap: .36rem;
    align-items: end;
    justify-items: center;
    border: 1px solid color-mix(in srgb, var(--cx-brand-primary) 14%, var(--cx-border));
    border-radius: var(--cx-radius-lg);
    background: color-mix(in srgb, var(--cx-surface) 84%, transparent);
    color: var(--cx-text);
    padding: .65rem .45rem;
    cursor: pointer;
    scroll-snap-align: start;
    box-shadow: 0 8px 22px rgba(36, 16, 102, .055);
    transition: transform var(--cx-transition), border-color var(--cx-transition), box-shadow var(--cx-transition), opacity var(--cx-transition);
  }
  .cx-hour-block:hover,
  .cx-hour-block:focus-visible {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--cx-brand-accent) 42%, var(--cx-border));
    outline: none;
    box-shadow: 0 0 0 4px var(--cx-focus), var(--cx-shadow-card);
  }
  .cx-hour-block.is-zero { opacity: .5; filter: saturate(.7); }
  .cx-hour-bar {
    inline-size: 22px;
    min-block-size: 8px;
    border-radius: 999px 999px 5px 5px;
    background: linear-gradient(180deg, #8b5cf6, var(--cx-brand-accent));
  }
  .cx-hour-block.is-zero .cx-hour-bar { background: color-mix(in srgb, var(--cx-muted) 30%, transparent); }
  .cx-hour-label { color: var(--cx-muted); font-weight: 900; font-size: .82rem; }
  .cx-hour-block strong { color: var(--cx-brand-strong); font-size: .82rem; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cx-hour-block small { color: var(--cx-muted); font-size: .72rem; font-weight: 850; }
  [data-theme="dark"] .cx-hour-block { background: color-mix(in srgb, var(--cx-surface) 92%, #050016 8%); box-shadow: 0 12px 26px rgba(0,0,0,.24); }
  [data-theme="dark"] .cx-hour-block:not(.is-zero) strong { color: #fff; }

  .cx-dashboard-breakdowns { margin-block: var(--cx-space-5); }
  .cx-dashboard-breakdowns .cx-card { background: var(--cx-panel-bg); }
  .cx-dashboard-bar-list { display: grid; gap: .7rem; }
  .cx-dashboard-bar-row {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.6fr) auto auto;
    gap: .75rem;
    align-items: center;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius-md);
    background: color-mix(in srgb, var(--cx-surface) 82%, transparent);
    padding: .65rem .75rem;
    color: var(--cx-text);
    text-align: start;
    cursor: pointer;
    transition: background var(--cx-transition), border-color var(--cx-transition), transform var(--cx-transition);
  }
  .cx-dashboard-bar-row:hover { transform: translateY(-1px); background: linear-gradient(135deg, rgba(91,26,163,.09), rgba(216,59,190,.07)); border-color: rgba(216,59,190,.25); }
  .cx-dashboard-bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
  .cx-dashboard-bar-track { position: relative; block-size: 10px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--cx-muted) 14%, transparent); }
  .cx-dashboard-bar-track span { display: block; block-size: 100%; border-radius: inherit; background: linear-gradient(90deg, #5b1aa3, #d83bbe); }
  .cx-dashboard-bar-row strong { color: var(--cx-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .cx-dashboard-bar-row em { min-inline-size: 58px; padding: .25rem .55rem; border-radius: 999px; background: var(--cx-brand-soft); color: var(--cx-brand-strong); font-style: normal; font-weight: 950; text-align: center; }

  .cx-dashboard-inbox-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--cx-space-3);
    padding: .85rem 1rem;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius-lg);
    background: color-mix(in srgb, var(--cx-surface) 82%, transparent);
    color: inherit;
    text-decoration: none;
    margin-block-end: .65rem;
    transition: transform var(--cx-transition), border-color var(--cx-transition), background var(--cx-transition);
  }
  .cx-dashboard-inbox-item:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--cx-brand-accent) 28%, var(--cx-border)); }
  .cx-dashboard-inbox-item small { display: block; color: var(--cx-muted); margin-block-start: .18rem; }
  .cx-dashboard-inbox-item[data-severity="danger"] { border-color: var(--cx-sem-loss-line); background: var(--cx-sem-loss-soft); }
  .cx-dashboard-inbox-item[data-severity="warn"] { border-color: var(--cx-sem-pending-line); background: var(--cx-sem-pending-soft); }
  .cx-dashboard-inbox-item[data-severity="ok"] { border-color: var(--cx-sem-profit-line); background: var(--cx-sem-profit-soft); }

  .cx-dashboard-timeline { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
  .cx-dashboard-timeline li {
    display: grid;
    grid-template-columns: 1.1fr .75fr auto;
    gap: .7rem;
    align-items: center;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius-md);
    background: color-mix(in srgb, var(--cx-surface) 72%, transparent);
    padding: .65rem .85rem;
  }
  .cx-dashboard-timeline li span { color: var(--cx-text); font-weight: 900; }
  .cx-dashboard-timeline li span::before {
    content: '';
    display: inline-block;
    inline-size: .58rem;
    block-size: .58rem;
    margin-inline-end: .45rem;
    border-radius: 999px;
    background: var(--cx-sem-color, var(--cx-brand-accent));
    box-shadow: 0 0 0 5px var(--cx-sem-soft, rgba(216,59,190,.12));
    vertical-align: middle;
  }
  .cx-dashboard-timeline time { color: var(--cx-muted); font-size: .86rem; direction: ltr; }
  .cx-dashboard-timeline li[data-semantic="revenue"] { --cx-sem-color: var(--cx-sem-revenue); --cx-sem-soft: var(--cx-sem-revenue-soft); }
  .cx-dashboard-timeline li[data-semantic="inventory"] { --cx-sem-color: var(--cx-sem-inventory); --cx-sem-soft: var(--cx-sem-inventory-soft); }
  .cx-dashboard-timeline li[data-semantic="expense"] { --cx-sem-color: var(--cx-sem-expense); --cx-sem-soft: var(--cx-sem-expense-soft); }
  .cx-dashboard-timeline li[data-semantic="pending"] { --cx-sem-color: var(--cx-sem-pending); --cx-sem-soft: var(--cx-sem-pending-soft); }
  .cx-dashboard-timeline li[data-semantic="danger"] { --cx-sem-color: var(--cx-sem-loss); --cx-sem-soft: var(--cx-sem-loss-soft); }
  .cx-dashboard-timeline li[data-semantic="cost"] { --cx-sem-color: var(--cx-sem-cost); --cx-sem-soft: var(--cx-sem-cost-soft); }
  .cx-dashboard-timeline li[data-semantic="production"] { --cx-sem-color: var(--cx-sem-production); --cx-sem-soft: var(--cx-sem-production-soft); }

  @media (max-width: 900px) {
    .cx-dashboard-bar-row { grid-template-columns: 1fr; }
    .cx-dashboard-bar-row em { justify-self: start; }
    .cx-dashboard-timeline li { grid-template-columns: 1fr; }
  }
}
