@layer app {
  .stats-grid { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; }
  .stat-card { background:var(--surface); border-radius: 12px; padding: .85rem 1rem; border: 1px solid var(--gray-200); cursor: pointer; transition: box-shadow .15s, transform .15s; text-decoration: none; color: inherit; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'icon value badge' 'icon label badge' 'sub sub sub'; column-gap: .75rem; align-items: center; }
  .stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
  .stat-header { display: contents; }
  .stat-icon { grid-area: icon; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
  .stat-icon svg { width: 18px; height: 18px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .stat-icon.blue { background: var(--blue-light); }
  .stat-icon.blue svg { stroke: var(--blue); }
  .stat-icon.green { background: var(--green-light); }
  .stat-icon.green svg { stroke: var(--green); }
  .stat-icon.orange { background: var(--orange-light); }
  .stat-icon.orange svg { stroke: var(--orange); }
  .stat-icon.violet { background: var(--violet-50); }
  .stat-icon.violet svg { stroke: var(--violet-600); }
  .stat-badge { grid-area: badge; align-self: start; font-size: .7rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px; }
  .stat-badge.blue { background: var(--blue-light); color: var(--blue); }
  .stat-badge.green { background: var(--green-light); color: var(--green); }
  .stat-badge.orange { background: var(--orange-light); color: var(--orange); }
  .stat-badge.violet { background: var(--violet-50); color: var(--violet-600); }
  .inv-card { grid-template-areas: 'icon . badge' 'rows rows rows'; }
  .inv-rows { grid-area: rows; display: flex; flex-direction: column; gap: .15rem; margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--gray-100); }
  .inv-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--gray-500); }
  .inv-row strong { font-size: 1rem; font-weight: 700; color: var(--gray-700); }
  .inv-row strong.inv-new { color: var(--blue); }
  .inv-row strong.inv-open { color: var(--orange); }
  .inv-row strong.inv-late { color: var(--red); }
  .stat-value { grid-area: value; align-self: end; font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
  .stat-label { grid-area: label; align-self: start; font-size: .78rem; color: var(--gray-500); margin-top: .1rem; }
  .stat-sub { grid-area: sub; font-size: .78rem; color: var(--gray-500); margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--gray-100); }
  .stat-sub strong { color: var(--gray-700); }
  .section-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

  .top-kunden { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(5, auto); column-gap: 2rem; }
  .top-kunde { display: flex; align-items: center; gap: .6rem; padding: .45rem .25rem; border-bottom: 1px solid var(--gray-100); min-width: 0; }
  .top-rank { font-size: .75rem; font-weight: 700; min-width: 18px; color: var(--gray-400); }
  .top-name { flex: 1; min-width: 0; font-size: .875rem; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-meta { font-size: .75rem; color: var(--gray-400); white-space: nowrap; }
  .top-sum { font-size: .8rem; font-weight: 700; min-width: 70px; text-align: right; white-space: nowrap; color: var(--gray-700); }
  .top-kunde.r1 .top-rank, .top-kunde.r1 .top-sum { color: var(--green); }
  .top-kunde.r2 .top-rank, .top-kunde.r2 .top-sum { color: var(--blue); }
  .top-kunde.r3 .top-rank, .top-kunde.r3 .top-sum { color: var(--orange); }
  .dash-layout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 1rem; align-items: stretch; margin-bottom: 2rem; }
  .dash-content { grid-column: 1 / 4; min-width: 0; }
  .dash-notify { display: flex; flex-direction: column; height: 0; min-height: 100%; }
  .notify-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 1.25rem .75rem; border-bottom: 1px solid var(--gray-100); }
  .notify-count { font-size: .7rem; font-weight: 700; min-width: 20px; padding: .1rem .4rem; border-radius: 99px; background: var(--blue); color: var(--surface); text-align: center; }
  .notify-count[hidden], .notify-all-read[hidden] { display: none; }
  .notify-all-read { background: none; border: 0; padding: 0; font: inherit; font-size: .75rem; font-weight: 600; color: var(--blue); cursor: pointer; white-space: nowrap; }
  .notify-all-read:hover { text-decoration: underline; }
  .notify-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .25rem 0; }
  .notify-item { --tone: var(--gray-400); --tone-bg: var(--gray-50); display: flex; gap: .6rem; padding: .65rem 1.25rem .65rem calc(1.25rem - 3px); text-decoration: none; color: inherit; border-bottom: 1px solid var(--gray-100); border-left: 3px solid transparent; }
  .notify-item.tone-green { --tone: var(--green); --tone-bg: var(--green-light); }
  .notify-item.tone-red { --tone: var(--red); --tone-bg: var(--red-light); }
  .notify-item.tone-orange { --tone: var(--orange); --tone-bg: var(--orange-light); }
  .notify-item.tone-blue { --tone: var(--blue); --tone-bg: var(--blue-light); }
  .notify-item.tone-violet { --tone: var(--violet-600); --tone-bg: var(--violet-50); }
  .notify-item.tone-gray { --tone: var(--gray-500); --tone-bg: var(--gray-50); }
  .notify-item:last-child { border-bottom: 0; }
  .notify-item.unread { border-left-color: var(--tone); background: var(--tone-bg); }
  .notify-item:hover { background: var(--gray-50); }
  .notify-item.unread:hover { background: var(--tone-bg); filter: brightness(.98); }
  .notify-dot { flex: none; width: 8px; height: 8px; margin-top: .35rem; border-radius: 50%; background: var(--tone); }
  .notify-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
  .notify-title { font-size: .82rem; color: var(--gray-600); }
  .notify-text { font-size: .8rem; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .notify-item.update .notify-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
  .notify-meta { font-size: .72rem; color: var(--gray-400); }
  .notify-item .notify-title { color: var(--tone); }
  .notify-item.unread .notify-title { font-weight: 700; }
  .notify-item:not(.unread) .notify-dot { opacity: .45; }
  .notify-empty { padding: 1.25rem; font-size: .8rem; color: var(--gray-400); }
  @media (max-width: 1100px) {
    .dash-layout { grid-template-columns: minmax(0, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .dash-content { grid-column: auto; }
    .dash-notify { height: auto; min-height: 0; max-height: 420px; order: -1; }
  }
  @media (max-width: 767px) {
    .stats-grid { grid-template-columns: 1fr; }
    .top-kunden { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
    .top-meta { display: none; }
  }
}
