/* KOVA TWIN — Widgets, Home „… jetzt", Einbettung. Design ist Daten: Komponenten lesen NUR Tokens
   (style.css :root); hier kommen nur die zwei Tokens dazu, die es vorher nicht gab. */
:root { --scrim: rgba(14,42,71,.28); --tile: rgba(255,255,255,.96); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="daylight"]) { --scrim: rgba(0,0,0,.5); --tile: rgba(30,34,41,.96); } }
:root[data-theme="dark"] { --scrim: rgba(0,0,0,.5); --tile: rgba(30,34,41,.96); }

/* ── Kachel ──────────────────────────────────────────────────────────────────────────────── */
.w { background: var(--tile); color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 120px; }
.w[role="button"] { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.w[role="button"]:hover { box-shadow: var(--shadow); }
.w:focus-visible, .w [data-target-layer]:focus-visible, .home-cta:focus-visible, .home-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.w-head { display: flex; align-items: center; gap: 8px; }
.w-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 0; flex: 1; }
.w-tag { font-size: .68rem; padding: 1px 7px; border-radius: 6px; background: rgba(245,181,46,.25); color: var(--ink-2); }
.w-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.w-body p { margin: 0; }
.w-value { line-height: 1.1; }
.w-num { font-size: 2rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .w-num { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="daylight"]) .w-num { color: var(--ink); } }
.w-unit, .w-fields, .w-sub, .w-note, .w-empty { color: var(--ink-2); font-size: .9rem; }
.w-sub, .w-note { font-size: .8rem; color: var(--muted); }
.w-trend { font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.w-foot { font-size: .68rem; color: var(--muted); line-height: 1.3; }

.w-meter { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; margin: 4px 0; }
.w-meter i { display: block; height: 100%; background: var(--muted); }
.lvl-good > .w-dot, .w-meter i.lvl-good { background: var(--good); }
.lvl-warn > .w-dot, .w-meter i.lvl-warn { background: var(--warn); }
.lvl-bad > .w-dot, .w-meter i.lvl-bad { background: var(--bad); }
.w-items, .w-list, .w-sparks { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: .88rem; }
.w-items li { display: flex; align-items: center; gap: 8px; border-radius: 6px; padding: 2px 4px; }
.w-items li[data-target-layer]:hover, .w-sparks li[data-target-layer]:hover { background: rgba(42,120,214,.10); }
.w-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.w-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-items b, .w-sparks b { font-variant-numeric: tabular-nums; }
.w-items small, .w-sparks small { color: var(--muted); font-variant-numeric: tabular-nums; }
.w-list li { display: grid; grid-template-columns: 3.4em auto 1fr; gap: 8px; align-items: baseline; }
.w-list time { font-weight: 700; font-variant-numeric: tabular-nums; }
.w-line { background: var(--brand); color: #fff; border-radius: 5px; padding: 0 6px; font-size: .78rem; font-weight: 700; text-align: center; }
.w-to { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.w-sparks li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n v" "s s" "r r"; gap: 0 8px; padding: 2px 4px; border-radius: 6px; }
.w-sparks .w-name { grid-area: n; } .w-sparks b { grid-area: v; } .w-sparks small { grid-area: r; font-size: .72rem; }
.w-spark { grid-area: s; width: 100%; height: 32px; }
.w-spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.w-figure { margin: 0; }
.w-figure img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; display: block; background: var(--border); }
.w-figure figcaption { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.w-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: .85rem; }
.w-badge-on { background: rgba(12,163,12,.15); color: var(--ink); } .w-badge-off { background: rgba(208,59,59,.15); color: var(--ink); }
.w-action { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--brand); color: #fff; text-decoration: none; font-weight: 600; min-height: 44px; line-height: 28px; }

/* ── Home „… jetzt" ─────────────────────────────────────────────────────────────────────────── */
.home { position: fixed; inset: 0; z-index: 7; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 72px 16px 16px; }
.home-card { background: var(--surface); backdrop-filter: blur(10px); border-radius: var(--radius); box-shadow: var(--shadow); width: min(1120px, 100%); max-height: 100%; overflow: auto; padding: 18px 20px 20px; }
.home-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 14px; }
.home-head h2 { margin: 0; font-size: 1.4rem; color: var(--ink); flex: 1 1 auto; }
.home-head p { margin: 0; color: var(--ink-2); font-size: .92rem; flex: 1 1 100%; order: 3; }
.home-cta { border: 0; background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; cursor: pointer; min-height: 44px; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 12px; }
.home-grid > .size-m, .home-grid > .size-l { grid-column: 1 / -1; }
@media (min-width: 860px) { .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-grid > .size-m { grid-column: span 2; } }
@media (min-width: 1100px) { .home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.home-open { flex: none; border: 0; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; font-weight: 600; min-height: 44px; }
@media (max-width: 720px) { /* Bottom-Sheet auf Mobil: die Karte bleibt oben sichtbar */
  .home { align-items: flex-end; padding: 0; }
  .home-card { width: 100%; max-height: 86vh; border-radius: 16px 16px 0 0; padding: 14px 14px 18px; }
  .home-card::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 10px; }
  .home-head h2 { font-size: 1.2rem; }
  .home-open { position: fixed; top: 66px; right: 12px; padding: 8px 12px; } /* Kopfzeile bleibt der Suche */
}
@media (prefers-reduced-motion: reduce) { .w[role="button"] { transition: none; } }

/* ── Einbettung (/embed/:id) ─────────────────────────────────────────────────────────────────── */
body.embed { height: auto; min-height: 100%; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
body.embed .embed-wrap { flex: 1; }
body.embed .w { min-height: 0; }
.embed-foot { font-size: .7rem; color: var(--muted); }
.embed-foot a { color: var(--accent); }
