/* Kopie aus duranco-holding apps/hub/components.css (Design R49, Stand 2a45050), nur gelesen und kopiert – keine Abhängigkeit. */
/* Kopie von ops/design/admin/components.css (Design R49, Commit 96aabb4) für apps/hub (R53).
   Änderungen zuerst im Design-Ordner, dann hierher kopieren. App-spezifisches: hub.css. */

/* Duran Co. Admin – Bausteine (Entwurf R49)
   Ruhig, dicht, präzise. Radius 4 px, Linien statt Schatten, Akzent sparsam.
   Nur Variablen aus tokens.css; kein Inline-Stil nötig (CSP Stufe 2). */

/* --- Grundlage ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font); font-size: var(--fs); line-height: var(--lh);
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }

:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--sp-2); top: -100px; z-index: 100;
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.skip-link:focus { top: var(--sp-2); }

.icon {
  width: var(--icon); height: var(--icon); flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* Trefferfläche 44 px für sichtbar kleinere Steuerelemente (Handy) */
.hit { position: relative; }
.hit::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: max(100%, var(--tap)); height: max(100%, var(--tap));
  transform: translate(-50%, -50%);
}
@media (min-width: 1024px) and (pointer: fine) { .hit::after { content: none; } }

/* --- Rahmen: Kopfzeile, Navigation, Tab-Leiste ---------------------------- */
.shell { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-2);
  height: calc(var(--head-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--sp-1) 0 var(--sp-3);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); color: var(--text); }
.topbar__brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; border-radius: var(--radius); overflow: hidden; }
.logo__bg { fill: var(--accent); }
.logo__fg { fill: var(--on-accent); }
.topbar__name { display: none; font-weight: var(--fw-semibold); }
.topbar__sep { display: none; width: 1px; height: 20px; background: var(--line); }
.topbar__title { flex: 1; min-width: 0; font-size: var(--fs-title); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search { display: none; position: relative; }
.search .icon { position: absolute; left: var(--sp-2); top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search__input {
  width: 280px; height: var(--ctl-h); padding: 0 var(--sp-2) 0 28px;
  font-size: var(--fs-input); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.search__input::placeholder { color: var(--muted); opacity: 1; }
.search__input:focus-visible { outline-offset: 1px; background: var(--surface); border-color: var(--input-line); }

.user { display: flex; align-items: center; gap: var(--sp-2); height: var(--tap); padding: 0 var(--sp-2); border: 0; background: none; border-radius: var(--radius); }
.user:hover { background: var(--hover); }
.user__name { display: none; }
.user .icon { display: none; color: var(--muted); }
.avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius);
  background: var(--selected); color: var(--text); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}

.draftbar {
  display: flex; align-items: center; gap: var(--sp-2);
  height: var(--note-h); padding: 0 var(--sp-3);
  background: var(--note-bg); color: var(--note-text); border-bottom: 1px solid var(--note-line);
  font-size: var(--fs-sm);
}

.sidenav { display: none; }

.main { padding: var(--sp-3) var(--sp-3) calc(var(--tab-h) + env(safe-area-inset-bottom) + var(--sp-4)); min-width: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: var(--fs-xs); line-height: 1.2;
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab[aria-current="page"] { color: var(--accent-ink); font-weight: var(--fw-semibold); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; background: var(--accent-ink); }
.tab:focus-visible { outline-offset: -4px; }

.sidenav__list { display: flex; flex-direction: column; }
.sidenav__item {
  position: relative; display: flex; align-items: center; gap: var(--sp-2);
  height: var(--nav-item-h); padding: 0 var(--sp-3) 0 var(--sp-4);
  color: var(--text);
}
.sidenav__item:hover { background: var(--hover); text-decoration: none; }
.sidenav__item .icon { color: var(--muted); }
.sidenav__item[aria-current="page"] { background: var(--selected); color: var(--accent-ink); font-weight: var(--fw-semibold); }
.sidenav__item[aria-current="page"] .icon { color: var(--accent-ink); }
.sidenav__item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; background: var(--accent-ink); }
.sidenav__item:focus-visible { outline-offset: -2px; }
.sidenav__label { flex: 1; }
.sidenav__count { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; font-weight: var(--fw-regular); }
.sidenav__group { padding: var(--sp-4) var(--sp-4) var(--sp-1); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sidenav__foot { margin-top: auto; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-xs); color: var(--muted); border-top: 1px solid var(--line); }

@media (min-width: 1024px) {
  .shell {
    display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "top top" "note note" "nav main";
  }
  .topbar { grid-area: top; gap: var(--sp-3); padding: 0 var(--sp-3) 0 var(--sp-4); }
  .draftbar { grid-area: note; padding-left: var(--sp-4); }
  .topbar__name, .topbar__sep, .user__name, .user .icon { display: block; }
  .search { display: block; margin-left: auto; }
  .topbar__title { flex: 0 1 auto; }
  .topbar .search-toggle { display: none; }
  .user { height: var(--ctl-h); }
  .sidenav {
    grid-area: nav; position: sticky; top: var(--head-h);
    display: flex; flex-direction: column;
    height: calc(100vh - var(--head-h) - var(--note-h)); height: calc(100dvh - var(--head-h) - var(--note-h));
    padding-top: var(--sp-2);
    background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto;
  }
  .main { grid-area: main; padding: var(--sp-4) var(--sp-5) var(--sp-5); }
  .tabbar { display: none; }
}

/* --- Bereiche (hub.html) --------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
@media (min-width: 1024px) { .stack { gap: var(--sp-4); } }
body:where([data-view]) [data-area] { display: none; }
body[data-view="heute"] :is([data-area="status"], [data-area="aufgaben"], [data-area="fristen"], [data-area="marken"]),
body[data-view="marken"]  [data-area="marken"],
body[data-view="system"]  [data-area="system"],
body[data-view="fristen"] [data-area="fristen"],
body[data-view="vertraege"] [data-area="vertraege"],
body[data-view="mehr"]    [data-area="mehr"] { display: block; }
body[data-view="heute"] .tbl--deadlines tbody tr:nth-child(n+6) { display: none; }
body:not([data-view="heute"]) [data-only-heute] { display: none; }

/* --- Panel (Abschnitt) ----------------------------------------------------- */
.panel {
  container-type: inline-size;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 0;
}
.panel__head {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 40px; padding: 0 var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.panel__title { font-size: var(--fs-h); font-weight: var(--fw-semibold); }
.panel__meta { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.panel__end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }
.panel__body { padding: var(--sp-3); }
.panel__link { display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--fs-sm); }
@media (min-width: 1024px) and (pointer: fine) { .panel__link { min-height: 0; } }

/* --- Status: Punkt + Text -------------------------------------------------- */
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status::before {
  content: ""; width: var(--dot); height: var(--dot); border-radius: 50%; flex: none;
  background: var(--status-c, var(--paused));
}
.status--ok     { --status-c: var(--ok); }
.status--warn   { --status-c: var(--warn); }
.status--err    { --status-c: var(--err); }
.status--paused { --status-c: var(--paused); }
.status--neutral::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--paused); }

/* --- Statuszeile ----------------------------------------------------------- */
.statusbar {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.statusbar__item {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0;
  min-height: var(--tap); padding: 0 var(--sp-3);
  color: var(--text);
}
.statusbar__item:hover { background: var(--hover); text-decoration: none; }
.statusbar__item:focus-visible { outline-offset: -2px; }
.statusbar li { min-width: 0; }
.statusbar li:nth-child(even) { border-left: 1px solid var(--line); }
.statusbar li:nth-child(n+3) { border-top: 1px solid var(--line); }
.statusbar__label { color: var(--muted); }
@media (max-width: 1023.98px) { .statusbar__item { font-size: var(--fs-sm); } }
.statusbar__value { font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1024px) {
  .statusbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .statusbar__item { min-height: 40px; }
  .statusbar li + li { border-left: 1px solid var(--line); }
  .statusbar li:nth-child(n+3) { border-top: 0; }
}

/* --- Tabelle (breit) / Liste (schmal, per Container-Query) ---------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  height: 32px; padding: 0 var(--sp-3);
  text-align: left; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--muted);
  background: var(--surface-alt); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { height: var(--row-h); padding: 0 var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .c-act { width: 1%; text-align: right; white-space: nowrap; }
.tbl .c-strong { font-weight: var(--fw-medium); }
.tbl .c-date { width: 110px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .c-prio { width: 110px; }
.tbl .c-brand { width: 140px; white-space: nowrap; }
.tbl .c-state { width: 150px; }
.th-tip { display: inline-flex; align-items: center; gap: var(--sp-1); }
.th-num { text-align: right !important; }
.th-num .th-tip { justify-content: flex-end; }

@container (max-width: 559px) {
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl thead .tip { display: none; }
  .tbl tbody tr {
    display: grid; align-items: center; column-gap: var(--sp-2);
    min-height: var(--tap); padding: 5px var(--sp-3);
    border-bottom: 1px solid var(--line);
  }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { height: auto; padding: 0; border: 0; width: auto; min-width: 0; text-align: left; line-height: 18px; }
  .tbl .c-date, .tbl .c-prio, .tbl .c-brand, .tbl .c-state { width: auto; }
  .tbl tbody tr:hover td { background: none; }
  .tbl .c-meta { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
  .tbl .c-sep::before { content: "·"; margin-right: var(--sp-2); color: var(--muted); }
  .tbl .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Aufgaben: Thema / Priorität · Marke · fällig | Aktion */
  .tbl--tasks tbody tr { grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-areas: "topic topic topic amt act" "prio brand due amt act"; }
  .tbl--tasks .num { grid-area: amt; }
  .tbl--tasks .c-topic { grid-area: topic; }
  .tbl--tasks .c-prio  { grid-area: prio; }
  .tbl--tasks .c-brand { grid-area: brand; }
  .tbl--tasks .c-due   { grid-area: due; text-align: left; }
  .tbl--tasks .c-act   { grid-area: act; padding-left: var(--sp-2); }

  /* Fristen: Datum | Vorgang / Marke | Status */
  .tbl--deadlines tbody tr { grid-template-columns: 96px minmax(0, 1fr) auto; grid-template-areas: "date title state" "date brand state"; }
  .tbl--deadlines .c-date  { grid-area: date; font-size: var(--fs-sm); color: var(--muted); }
  .tbl--deadlines .c-title { grid-area: title; }
  .tbl--deadlines .c-brand { grid-area: brand; }
  .tbl--deadlines .c-state { grid-area: state; justify-self: end; font-size: var(--fs-sm); }

  /* Marken: Name | Status / Kennzahlen | Öffnen */
  .tbl--brands tbody tr { grid-template-columns: auto auto auto minmax(0, 1fr) auto; grid-template-areas: "name name name state act" "k1 k2 k3 . act"; }
  .tbl--brands .c-name  { grid-area: name; }
  .tbl--brands .c-state { grid-area: state; justify-self: end; font-size: var(--fs-sm); }
  .tbl--brands .c-k1 { grid-area: k1; }
  .tbl--brands .c-k2 { grid-area: k2; }
  .tbl--brands .c-k3 { grid-area: k3; }
  .tbl--brands .c-kpi { font-size: var(--fs-sm); color: var(--muted); text-align: left; padding-right: var(--sp-2); }
  .tbl--brands .c-kpi::after { content: " " attr(data-short); }
  .tbl--brands .c-k2::before, .tbl--brands .c-k3::before { content: "·"; margin-right: var(--sp-2); }
  .tbl--brands .c-act { grid-area: act; padding-left: var(--sp-3); }

  /* System: Dienst | Status / Detail | geprüft */
  .tbl--system tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name state" "detail checked"; }
  .tbl--system .c-name    { grid-area: name; }
  .tbl--system .c-state   { grid-area: state; justify-self: end; font-size: var(--fs-sm); }
  .tbl--system .c-detail  { grid-area: detail; }
  .tbl--system .c-checked { grid-area: checked; justify-self: end; }

  .btn--compact { width: 32px; padding: 0; }
  .btn--compact .btn__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@container (min-width: 560px) { .btn--compact .icon { display: none; } }

/* --- Listen (Mehr) --------------------------------------------------------- */
.list > li + li { border-top: 1px solid var(--line); }
.list__item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  min-height: var(--row-h); padding: 0 var(--sp-3);
  color: var(--text); background: none; border: 0; text-align: left;
}
.list__item:hover { background: var(--hover); text-decoration: none; }
.list__item:focus-visible { outline-offset: -2px; }
.list__item .icon { color: var(--muted); }
.list__label { flex: 1; }
.list__meta { color: var(--muted); font-size: var(--fs-sm); }

/* --- Knöpfe ---------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-h); padding: 0 var(--sp-3);
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: var(--fs); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
  transition: background-color var(--dur), border-color var(--dur);
}
.btn::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: max(100%, var(--tap)); height: max(100%, var(--tap)); transform: translate(-50%, -50%);
}
@media (min-width: 1024px) and (pointer: fine) { .btn::after { content: none; } }
.btn:hover { text-decoration: none; }
.btn--primary   { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--hover); }
.btn--danger    { background: var(--danger); color: var(--on-danger); }
.btn--danger:hover { background: var(--danger-hover); }
.btn--ghost     { background: none; color: var(--accent-ink); padding: 0 var(--sp-2); }
.btn--ghost:hover { background: var(--hover); }
.btn:disabled { background: var(--hover); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: var(--tap); height: var(--tap); padding: 0;
  border: 0; border-radius: var(--radius); background: none; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
@media (min-width: 1024px) and (pointer: fine) { .icon-btn { width: var(--ctl-h); height: var(--ctl-h); } }

/* --- Formular -------------------------------------------------------------- */
.form { display: grid; gap: var(--sp-3) var(--sp-4); grid-template-columns: minmax(0, 1fr); }
@container (min-width: 600px) { .form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form .span-2 { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); }
.field__hint { font-size: var(--fs-sm); color: var(--muted); }
.field__error { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--err-text); }
.input, .select, .textarea {
  width: 100%; height: var(--input-h); padding: 0 var(--sp-2);
  font-size: var(--fs-input); color: var(--text);
  background: var(--surface); border: 1px solid var(--input-line); border-radius: var(--radius);
}
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 1px; }
.input.num { text-align: right; }
.textarea { height: auto; min-height: 72px; padding: 6px var(--sp-2); resize: vertical; line-height: var(--lh); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.input[aria-invalid="true"] { border-color: var(--err); box-shadow: inset 0 0 0 1px var(--err); }
.select-wrap { position: relative; }
.select { appearance: none; -webkit-appearance: none; padding-right: 28px; }
.select-wrap .icon { position: absolute; right: var(--sp-2); top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.check { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--row-h); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg__opt { position: relative; display: flex; }
.seg__opt + .seg__opt { border-left: 1px solid var(--line-strong); }
.seg__opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg__opt span { display: inline-flex; align-items: center; height: var(--ctl-h); padding: 0 var(--sp-3); font-size: var(--fs); color: var(--text); background: var(--surface); }
.seg__opt input:checked + span { background: var(--selected); font-weight: var(--fw-semibold); }
.seg__opt input:focus-visible + span { outline: var(--focus-width) solid var(--focus); outline-offset: -2px; }

/* --- Tooltip: Erklärungen nur hier --------------------------------------- */
.tip { position: relative; display: inline-flex; }
.tip__btn { display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 0; background: none; color: var(--muted); border-radius: 50%; }
.tip__btn:hover { color: var(--text); }
@media (pointer: coarse) { .tip__btn { position: relative; } .tip__btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: var(--tap); height: var(--tap); transform: translate(-50%, -50%); } }
.tip__text {
  position: absolute; z-index: 40; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  width: max-content; max-width: 240px; padding: 6px var(--sp-2);
  background: var(--pop-bg); color: var(--pop-text); border-radius: var(--radius); box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm); font-weight: var(--fw-regular); line-height: 16px; text-align: left;
  white-space: normal; text-transform: none; letter-spacing: 0;
  visibility: hidden; opacity: 0; transition: opacity var(--dur); pointer-events: none;
}
.tip:hover .tip__text, .tip:focus-within .tip__text, .tip--show .tip__text { visibility: visible; opacity: 1; }
.tip[data-dismissed] .tip__text { visibility: hidden; opacity: 0; }
.tip--down .tip__text { bottom: auto; top: calc(100% + 6px); }
.tip--end .tip__text { left: auto; right: -8px; transform: none; }

/* --- Dialog (mit Schatten) ------------------------------------------------- */
.dialog {
  width: min(100% - 24px, 420px); padding: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: var(--overlay); }
.dialog__head { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.dialog__title { font-size: var(--fs-h); font-weight: var(--fw-semibold); }
.dialog__body { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
.dialog__name { font-family: var(--font-mono); font-size: var(--fs-sm); padding: 1px var(--sp-1); background: var(--hover); border-radius: var(--radius); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); background: var(--surface-alt); }
.dialog--static { position: static; display: block; margin: 0; }
.dialog--static .input { display: block; }

/* --- Toast (Popover mit Schatten) ------------------------------------------ */
.toasts {
  position: fixed; z-index: 50; left: var(--sp-3); right: var(--sp-3);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + var(--sp-2));
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); pointer-events: none;
}
@media (min-width: 1024px) { .toasts { left: auto; right: var(--sp-5); bottom: var(--sp-5); align-items: flex-end; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3);
  max-width: 420px; min-height: 40px; padding: 0 var(--sp-1) 0 var(--sp-3);
  background: var(--pop-bg); color: var(--pop-text); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.toast__text { flex: 1; }
.toast__action { height: var(--tap); padding: 0 var(--sp-2); border: 0; border-radius: var(--radius); background: none; color: var(--pop-link); font-weight: var(--fw-semibold); }
.toast .icon-btn { color: var(--pop-text); }
.toast .icon-btn:hover, .toast__action:hover { background: rgb(255 255 255 / .1); }
.toast :focus-visible { outline-color: var(--pop-link); }
.toast--static { display: inline-flex; }
@media (min-width: 1024px) and (pointer: fine) { .toast__action { height: var(--ctl-h); } }

/* --- Leerzustand ----------------------------------------------------------- */
.empty { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--row-h); padding: var(--sp-2) var(--sp-3); color: var(--muted); }

/* --- Musterseite ----------------------------------------------------------- */
.spec-grid { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .spec-grid .span-2 { grid-column: 1 / -1; } }
.narrow { max-width: 390px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 2px; border: 1px solid var(--line); vertical-align: -2px; margin-right: var(--sp-2); }
.sw-accent { background: var(--accent); } .sw-bg { background: var(--bg); } .sw-surface { background: var(--surface); }
.sw-line { background: var(--line); } .sw-input-line { background: var(--input-line); } .sw-text { background: var(--text); }
.sw-muted { background: var(--muted); } .sw-ok { background: var(--ok); } .sw-warn { background: var(--warn); }
.sw-err { background: var(--err); } .sw-paused { background: var(--paused); } .sw-danger { background: var(--danger); }
.sw-note { background: var(--note-bg); } .sw-pop { background: var(--pop-bg); }
.type-row { display: flex; align-items: baseline; gap: var(--sp-3); }
.type-row + .type-row { margin-top: var(--sp-2); }
.type-row__name { width: 140px; flex: none; font-size: var(--fs-sm); color: var(--muted); }
.t-title { font-size: var(--fs-title); font-weight: var(--fw-semibold); }
.t-h { font-size: var(--fs-h); font-weight: var(--fw-semibold); }
.t-sm { font-size: var(--fs-sm); color: var(--muted); }
.code { font-family: var(--font-mono); font-size: var(--fs-sm); }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
