/* ==========================================================================
   Vertriebsportal 2.23.0 – Design „Posteingang“
   Wird als letzte Datei geladen. mejo-Grün #009261 + Dunkelgrau #2B2E33,
   dunkle Seitenleiste (Desktop), Tab-Leiste (Smartphone), Anfragen als Postfach-Liste
   mit Zählerkacheln, Detail rechts daneben ab 1280 px.
   ========================================================================== */
:root {
  --mejo-green: #009261;
  --mejo-green-ink: #007A51;      /* Grün für Text auf Weiß (Kontrast ≥ 4,5:1) */
  --mejo-green-wash: #E6F4EE;
  --graphite: #2B2E33;
  --sidebar-w: 248px;
  --list-w: 460px;
  --tabbar-h: 60px;

  /* Bestehende Tokens (styles.css, theme.css) auf das neue Farbschema legen */
  --accent: var(--mejo-green);
  --accent-ink: var(--mejo-green-ink);
  --accent-wash: rgba(0, 146, 97, .10);
  --ink: var(--graphite);
  --ink-2: #5F646B;
  --ink-3: #6B7077;
  --muted: #5F646B;
  --line: #E4E6E8;
  --line-2: #C9CDD2;
  --pp-paper: #F5F6F7;
  --pp-paper-2: #EEF0F2;
  --sheet: #FFFFFF;
  --paper: #FFFFFF;
  --canvas: #F5F6F7;
  --red: var(--mejo-green);
  --red-dark: var(--mejo-green-ink);
  --blue: var(--graphite);
  --navy: var(--graphite);
  --warn-c: #9A5300;
  --bad: #B42318;
  --r: 8px;
  --shadow: 0 1px 2px rgba(43, 46, 51, .05);
}

/* ── Grundlagen ─────────────────────────────────────────── */
body { background: var(--canvas); color: var(--ink); }
h1, h2, h3 { font-stretch: 100%; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 2.6vw, 32px); }
:focus-visible { outline: 2px solid var(--mejo-green); outline-offset: 2px; }
input, select, textarea { background: #fff; border-color: var(--line-2); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.button { background: var(--mejo-green); border-color: var(--mejo-green); color: #fff; border-radius: 8px; }
.button:hover { background: var(--mejo-green-ink); border-color: var(--mejo-green-ink); }
.button--ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-2); }
.button--ghost:hover { background: var(--pp-paper); border-color: var(--ink-2); }
.text-button, .card a:not(.button), .admin-list a { color: var(--mejo-green-ink); }

/* Kennzeichen: ruhig, Schrift der Oberfläche statt Monospace */
.chips span, .status, .due-badge, .ctype, .score {
  font-family: var(--f-ui); font-size: 12px; font-weight: 500; line-height: 1.5;
  border: 0; border-radius: 99px; padding: 1px 9px; background: var(--pp-paper-2); color: var(--ink);
}
.status--new { background: var(--mejo-green-wash); color: #00663F; }
.status--won { background: #00704A; color: #fff; }
.status--lost { background: #FDECEA; color: #A8261B; }
.status--closed { color: var(--ink-2); }
.due-badge { background: var(--pp-paper); color: var(--ink-2); }
.due-badge--due { background: #FFF1DB; color: #8A4B00; }
.due-badge--overdue { background: #FFE2B8; color: #7A3F00; font-weight: 600; }
.ctype { border-radius: 4px; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }

/* ── Seitenleiste (ab 1101 px) ──────────────────────────── */
body.app { padding-left: var(--sidebar-w); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  display: flex; flex-direction: column; padding: 20px 12px 16px; box-sizing: border-box;
  background: var(--graphite); color: #fff; overflow-y: auto; overscroll-behavior: contain;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 24px; text-decoration: none; color: #A3A8AE; font-size: 12px; }
.sidebar__brand img { width: 64px; height: auto; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav > a, .sidebar__archive > summary {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 8px;
  color: #D5D8DC; text-decoration: none; font-size: 14px; cursor: pointer; list-style: none;
}
.sidebar__archive > summary::-webkit-details-marker { display: none; }
.sidebar__archive > summary::after { content: ""; width: 7px; height: 7px; margin: -3px 2px 0 auto; border-right: 1.5px solid #8A8F95; border-bottom: 1.5px solid #8A8F95; transform: rotate(45deg); transition: transform .15s; }
.sidebar__archive[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.sidebar__nav > a:hover, .sidebar__archive > summary:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar__nav > a[aria-current], .sidebar__archive > summary[aria-current] { background: rgba(255,255,255,.10); color: #fff; font-weight: 600; }
.sidebar__nav > a[aria-current] .nav-icon, .sidebar__archive > summary[aria-current] .nav-icon { color: #3CC48E; }
.nav-icon { flex: none; }
.sidebar__count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 10px; background: #F3B44B; color: var(--graphite); font-size: 12px; font-weight: 700; font-style: normal; display: inline-flex; align-items: center; justify-content: center; }
.sidebar__archive > div { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 10px 44px; }
.sidebar__archive > div a { padding: 3px 10px; border-radius: 99px; border: 1px solid rgba(255,255,255,.18); color: #D5D8DC; font-size: 12px; text-decoration: none; }
.sidebar__archive > div a:hover { color: #fff; border-color: rgba(255,255,255,.4); }
.sidebar__archive > div a[aria-current] { background: #fff; border-color: #fff; color: var(--graphite); }
.sidebar__divider { display: block; height: 1px; background: rgba(255,255,255,.1); margin: 10px 12px; }
.sidebar__foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.sidebar .lang-switch { align-self: flex-start; margin: 0 0 0 12px; background: transparent; border-color: rgba(255,255,255,.22); border-radius: 6px; }
.sidebar .lang-switch button { color: #A3A8AE; height: 28px; min-width: 38px; font-family: var(--f-ui); font-weight: 600; }
.sidebar .lang-switch button + button { border-left-color: rgba(255,255,255,.22); }
.sidebar .lang-switch button[aria-pressed="true"] { background: #fff; color: var(--graphite); }
.sidebar .lang-switch button:hover:not([aria-pressed="true"]) { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__account { display: flex; align-items: center; gap: 4px; }
.sidebar__account form { margin: 0; }
.sidebar__user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: #fff; text-decoration: none; }
.sidebar__user > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sidebar__user strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user small { font-size: 12px; color: #A3A8AE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user:hover, .sidebar__user[aria-current] { background: rgba(255,255,255,.08); }
.sidebar__user .avatar { box-shadow: none; }
.sidebar__logout { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: #A3A8AE; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.sidebar__logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar a:focus-visible, .sidebar summary:focus-visible, .sidebar button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.mobilebar, .tabbar { display: none; }

/* ── Seitenrahmen der übrigen Bereiche ──────────────────── */
.app .shell { padding: 32px 40px 64px; }
.app .hero { border-bottom: 0; padding-bottom: 0; }

/* ── Anfragen: Postfach ─────────────────────────────────── */
.inbox__list { max-width: 1100px; margin: 0 auto; padding: 24px 32px 48px; box-sizing: border-box; }
.inbox__placeholder { display: none; }
.inbox__head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.inbox__title h1 { margin: 0; font-size: 24px; font-weight: 800; }
.inbox__title p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.inbox__sync { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.sync-time { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sync-time::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mejo-green); }
.sync-button { display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: 600 12px var(--f-ui); cursor: pointer; }
.sync-button:hover { background: var(--pp-paper-2); color: var(--ink); }
.sync-button:disabled { opacity: 1; cursor: progress; }
.sync-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sync-button.is-working span { position: static; width: auto; height: auto; clip: auto; }
.sync-button.is-working svg { animation: sync-spin 1s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 12px; }
.tile {
  display: flex; flex-direction: column; justify-content: flex-start; gap: 2px; min-height: 64px; padding: 10px 12px;
  box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none;
}
.tile strong { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tile span { font-size: 12px; font-weight: 600; line-height: 1.25; }
.tile:hover { border-color: var(--line-2); }
.tile.has-items strong { color: var(--ink); }
.tile--new.has-items strong { color: var(--mejo-green-ink); }
.tile--overdue.has-items { background: #FFF7EA; border-color: #F6D59C; }
.tile--overdue.has-items strong { color: #8A4B00; }
.tile[aria-current] { border-color: var(--graphite); box-shadow: inset 0 0 0 1px var(--graphite); }

.inbox .sync-panel { margin: 0 0 12px; padding: 8px 12px; border: 1px dashed var(--line-2); border-radius: 8px; font-family: var(--f-ui); font-size: 12px; color: var(--ink-2); background: transparent; }
.inbox .sync-panel p { margin: 0; }
.inbox .sync-panel progress { display: block; margin-top: 6px; }
.inbox .sync-panel.is-quiet { display: none; }

.inbox-filters { margin: 0; }
.inbox-filters__row { position: relative; display: flex; gap: 8px; align-items: center; }
.inbox-search { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink-2); }
.inbox-search:focus-within { border-color: var(--mejo-green); box-shadow: 0 0 0 3px var(--accent-wash); }
.inbox-search input { flex: 1; min-width: 0; height: 40px; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none !important; font-size: 15px; }
.filter-more { flex: none; }
.filter-more > summary { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px; box-sizing: border-box; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; }
.filter-more > summary::-webkit-details-marker { display: none; }
.filter-more > summary em { font-style: normal; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; background: var(--graphite); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.filter-more[open] > summary { border-color: var(--graphite); }
.filter-more__panel {
  position: absolute; left: 0; right: 0; top: 50px; z-index: 15;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px -12px rgba(43,46,51,.28);
}
.filter-more__panel label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-more__panel label > span { font-family: var(--f-ui); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.filter-more__panel .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
.inbox__meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0 8px; font-size: 12px; color: var(--ink-2); }
.inbox__meta .text-button { min-height: 0; font-size: 12px; }

.inbox-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.inbox-item + .inbox-item { border-top: 1px solid var(--line); }
.inbox-list .inbox-item__link {
  display: flex; gap: 10px; padding: 14px 16px 14px 12px; border: 0; border-radius: 0; background: transparent;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.inbox-list .inbox-item__link:hover { background: #F8F9FA; border: 0; }
.inbox-list .inbox-item__link:focus-visible { outline-offset: -2px; }
.inbox-item[aria-current] .inbox-item__link { background: #EAF5F0; box-shadow: inset 3px 0 0 var(--mejo-green); }
.inbox-item__dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; }
.inbox-item.is-new .inbox-item__dot { background: var(--mejo-green); }
.inbox-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.inbox-item__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.inbox-item__top strong { min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item.is-new .inbox-item__top strong { font-weight: 800; }
.inbox-item__top time { flex: none; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.inbox-item__products { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--ink-2); }
.inbox-item__meta .due-badge, .inbox-item__meta .ctype { margin: 0; display: inline-block; }
.inbox-item__place { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.inbox-item__value { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.inbox-item__assignee { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.inbox-item__assignee .avatar { box-shadow: none; }
.inbox .empty { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.inbox .pagination { border-top: 0; padding: 16px 0 0; }

/* Dialog (Popup, Seitenbereich, Vollbild) */
#detail-dialog { background: var(--canvas); border-radius: 12px; }
.dialog-toolbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); padding: 12px 20px; }
.dialog-toolbar h2 { font-size: 15px; font-weight: 700; }
.dialog-toolbar a { color: var(--mejo-green-ink); font-size: 13px; }
.dialog-toolbar button { border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 8px; font-size: 13px; }
.dialog-toolbar .dialog-back { display: none; }
.dialog-loading { color: var(--ink-2); }

/* Detailansicht: Kopf, Schnellaktionen */
.detail-heading { margin-bottom: 14px; }
.detail-heading h2 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; font-stretch: 100%; }
.detail-heading__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px !important; }
.detail-heading__tags .due-badge, .detail-heading__tags .ctype { margin: 0; }
.detail-actionbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.quick-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none;
}
.quick-action:hover { background: var(--pp-paper); border-color: var(--ink-2); }
.quick-action--primary { background: var(--mejo-green); border-color: var(--mejo-green); color: #fff; }
.quick-action--primary:hover { background: var(--mejo-green-ink); border-color: var(--mejo-green-ink); color: #fff; }
.focused-grid > div { border-radius: 10px; }
.sales-editor { scroll-margin-top: 12px; }

/* Standalone-Detailseite */
.detail-page .topbar { background: #fff; border-bottom: 1px solid var(--line); gap: 16px; }
.detail-page .topbar .brand { margin-right: auto; }
.detail-page .detail-back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; text-decoration: none; }

/* ── Breit: Liste links, Detail rechts (ab 1280 px) ─────── */
@media (min-width: 1280px) {
  .inbox { display: grid; grid-template-columns: var(--list-w) minmax(0, 1fr); min-height: 100vh; }
  .inbox__list { max-width: none; margin: 0; padding: 24px 20px 40px; background: #fff; border-right: 1px solid var(--line); }
  .inbox-list { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0 -20px; }
  .inbox .empty { border: 0; }
  .inbox__placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; position: sticky; top: 0; height: 100vh; color: #A3A8AE; }
  .inbox__placeholder p { margin: 0; font-size: 14px; color: var(--ink-2); }
  .inbox .filter-more__panel { grid-template-columns: 1fr 1fr; }
  #detail-dialog.is-pane {
    position: fixed; inset: 0 0 0 calc(var(--sidebar-w) + var(--list-w)); margin: 0; width: auto; height: 100vh; max-width: none; max-height: none;
    border-radius: 0; box-shadow: none; z-index: 20; background: var(--canvas);
  }
  #detail-dialog.is-pane .dialog-content { padding: 24px 28px 40px; }
}
@media (min-width: 1280px) and (max-width: 1699px) {
  #detail-dialog.is-pane .focused-grid { grid-template-columns: 1fr; }
  #detail-dialog.is-pane .detail-grid .sales-editor form.detail-edit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #detail-dialog.is-pane .journey__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #detail-dialog.is-pane .journey__facts > div:nth-child(3) { border-left: 0; }
  #detail-dialog.is-pane .journey__facts > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ── Smartphone und Tablet (bis 1100 px) ────────────────── */
@media (max-width: 1100px) {
  body.app { padding-left: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .mobilebar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 12px 0 16px; background: #fff; border-bottom: 1px solid var(--line);
  }
  .mobilebar__brand { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 12px; text-decoration: none; }
  .mobilebar__brand img { width: 60px; height: auto; }
  .mobilebar__account { display: inline-flex; padding: 4px; border-radius: 50%; text-decoration: none; }
  .mobilebar__account .avatar { box-shadow: none; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar > a, .tabbar .mobile-menu__toggle {
    height: var(--tabbar-h); width: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; border-radius: 0; background: transparent; color: var(--ink-2); font-size: 11px; font-weight: 500; text-decoration: none; cursor: pointer; list-style: none;
  }
  .tabbar > a[aria-current], .tabbar .mobile-menu[open] .mobile-menu__toggle { color: var(--mejo-green-ink); font-weight: 700; }
  .tabbar__icon { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 22px; }
  .tabbar__icon em { position: absolute; top: -6px; left: 13px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: #F3B44B; color: var(--graphite); font-size: 11px; font-weight: 700; font-style: normal; display: inline-flex; align-items: center; justify-content: center; }
  .tabbar .mobile-menu { display: block; margin: 0; }
  .tabbar .mobile-menu__toggle:focus-visible { outline: 2px solid var(--mejo-green); outline-offset: -4px; }
  .tabbar .burger { width: 20px; height: 14px; }
  .tabbar .burger span { background: currentColor; }
  .tabbar .mobile-menu__panel { top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 55; background: #fff; border: 0; padding: calc(16px + env(safe-area-inset-top)) 16px 24px; }
  .tabbar .mobile-menu__panel .lang-switch { background: #fff; }

  .app .shell { padding: 20px 16px 40px; }
  .inbox__list { padding: 16px 16px 32px; }
  .inbox__title h1 { font-size: 22px; }

  /* Detail als Vollbild mit Zurück-Pfeil */
  #detail-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .dialog-toolbar { padding: 4px 8px; min-height: 52px; align-items: center; flex-wrap: nowrap; }
  .dialog-toolbar .dialog-back { display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 8px; border: 0; background: transparent; font-size: 15px; font-weight: 600; }
  .dialog-toolbar h2 { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: auto; padding-right: 8px; }
  .dialog-toolbar > div { display: none; }
  .dialog-content { padding: 12px 12px 0; }

  /* Schnellaktionen als feste Leiste unten */
  [data-detail] { display: flex; flex-direction: column; }
  [data-detail] > * { min-width: 0; }
  .detail-actionbar {
    order: 99; position: sticky; bottom: 0; z-index: 3; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px;
    margin: 16px -12px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line);
  }
  .quick-action { min-height: 48px; padding: 0 8px; font-size: 15px; }
  .detail-page .standalone-detail { padding: 12px 12px 0; }
}
@media (max-width: 600px) {
  .tiles { gap: 6px; }
  .tile { padding: 10px; min-height: 60px; }
  .tile strong { font-size: 22px; }
  .filter-more__panel { grid-template-columns: 1fr; }
  .filter-more > summary { padding: 0 10px; }
  .inbox-item__assignee { margin-left: 0; }
}

/* ── Übrige Bereiche: Farben nachziehen ─────────────────── */
.heat__cell { background-image: linear-gradient(rgba(0,146,97,var(--v)), rgba(0,146,97,var(--v))); }
.kpis, .card, .panel, .figures, .account-card, .admin-create { box-shadow: var(--shadow); }
.login-page { background-image: none; background-color: var(--canvas); }
.login-card { border-radius: 14px; border-color: var(--line); }

@media (prefers-reduced-motion: reduce) {
  .sync-button.is-working svg { animation: none; }
}
@media print {
  body.app { padding: 0; }
  .sidebar, .mobilebar, .tabbar { display: none !important; }
}

/* ── 2.23.1: Warenbereich als Kennzeichen in Liste und Detail ─ */
.area-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 7px; border-radius: 4px;
  background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink);
  font-family: var(--f-ui); font-size: 12px; font-weight: 700; line-height: 1.5; letter-spacing: .02em; white-space: nowrap;
}
.area-chip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--area, #A3A8AE); }
.area-chip--nnk { --area: #3F6384; }
.area-chip--nns { --area: #6E4F7D; }
.area-chip--eip { --area: #2F6F6F; }
.area-chip--cnt { --area: #9A4A32; }
.area-chip--none { color: var(--ink-2); font-weight: 500; letter-spacing: 0; }
.area-chip--none::before { background: transparent; box-shadow: inset 0 0 0 1px #A3A8AE; }

/* ==========================================================================
   2.24.0 – Einheitliche Typografie und Bedienelemente auf allen Seiten
   Schrift: Work Sans (lokal: 400, 600, 700). Ersetzt Archivo und IBM Plex Mono
   aus theme.css. Fünf Textrollen, gleiche Buttons, Felder, Karten und Tabellen.
   ========================================================================== */
:root {
  --f-ui: 'Work Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --f-mono: var(--f-ui);
  --r: 8px;
  --r-card: 10px;
  --fs-title: 28px;   /* Seitentitel */
  --fs-h2: 18px;      /* Abschnitt */
  --fs-h3: 16px;      /* Kartentitel */
  --fs-body: 14px;
  --fs-small: 13px;
  --fs-meta: 12px;
  --fs-label: 11px;   /* Kennzeichnung über Werten, Tabellenköpfe */
}

/* Eine Schrift für alles – auch Formulare, Diagrammbeschriftungen und Kennzahlen */
body, body *:not(svg):not(path):not(circle):not(rect):not(line), input, select, textarea, button { font-family: var(--f-ui) !important; font-stretch: normal !important; }
svg text { font-family: var(--f-ui) !important; }
body { font-size: var(--fs-body); line-height: 1.5; }
strong, b { font-weight: 600; }
.num, td.num, .kpis strong, .figure__value, .order-figures strong, .journey-figures strong,
.bars__value, .bars__share, .trend__num, td, .sync-time, time { font-variant-numeric: tabular-nums; }

/* Überschriften */
h1, .hero h1, .stats-head h1, .login-card h1, .inbox__title h1 { font-size: var(--fs-title); font-weight: 700; line-height: 1.2; letter-spacing: -.015em; margin: 0 0 4px; }
h2, .table-head h2 { font-size: var(--fs-h2); font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.panel__head h2, .account-card h2, .admin-create h2, .card h2, .card h3, h3 { font-size: var(--fs-h3); font-weight: 700; letter-spacing: -.005em; }
.detail-heading h2 { font-size: 24px; font-weight: 700; letter-spacing: -.015em; }
.stats-head__scope { font-weight: 400; }
.hero p, .stats-head p, .inbox__title p { font-size: var(--fs-body); color: var(--ink-2); }

/* Rolle „Kennzeichnung“: klein, Versalien, ruhig – über Werten, Karten und in Tabellenköpfen */
.eyebrow, th, .rank th, .kpis span, .figure__label, .order-figures span, .journey-figures span,
.account-access dt, .order-label, .detail-grid > div > span, .focused-grid > div > span,
.request-detail > strong, .attachments > strong, .focused-grid .request-detail > strong,
.journey__facts dt, .heat__day, .heat__sum {
  font-size: var(--fs-label) !important; font-weight: 600 !important; letter-spacing: .05em !important;
  text-transform: uppercase; color: var(--ink-2) !important;
}
.heat__day, .heat__sum { text-transform: none; letter-spacing: 0 !important; }

/* Rolle „Feldbeschriftung“: Satzschreibung, gut lesbar */
.filters label > span, .stats-filters label > span, .filter-more__panel label > span,
.sales-editor label, .focused-grid .sales-editor label, .login-form label, .admin-form label, .account-form label,
.email-forward-panel label {
  font-size: var(--fs-small) !important; font-weight: 600 !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--ink) !important;
}
.sales-editor label, .admin-form label, .account-form label, .login-form label { display: grid; gap: 6px; }

/* Rolle „Hinweis“: Fußnoten, Erläuterungen, Zusatzzeilen */
.legend, .table-head span, .panel__head > span, .panel__foot, .stats-footnote, .figure__note, .kpis small,
td small, .admin-hint, .admin-form small, .account-form small, label small, .sales-meta, .journey__foot,
.detail-grid .journey__meta, .order-card__list small, .sync-panel, .split-legend small {
  font-size: var(--fs-meta) !important; font-weight: 400; letter-spacing: 0 !important; color: var(--ink-2) !important; line-height: 1.5;
}
.stats-footnote strong, .panel__foot strong { color: var(--ink); }

/* Kennzahlen */
.kpis strong, .figure__value, .order-figures strong, .journey-figures strong, .journey__facts dd strong {
  font-size: 26px !important; font-weight: 700 !important; letter-spacing: -.02em !important; line-height: 1.15; color: var(--ink);
}
.figures, .kpis { border-radius: var(--r-card) !important; }

/* Buttons: zwei Größen, drei Arten */
.button, a.button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0;
  min-height: 40px; padding: 0 16px; border-radius: var(--r) !important;
  font-size: var(--fs-body) !important; font-weight: 600 !important; line-height: 1; text-decoration: none; white-space: nowrap;
}
.button--small, .sales-actions .button, .email-forward-actions .button, .forward-history .button { min-height: 36px; padding: 0 14px; font-size: var(--fs-small) !important; margin: 0 !important; }
.button--ghost, a.button--ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-2); }
.button--ghost:hover { background: var(--pp-paper); border-color: var(--ink-2); color: var(--ink); }
.text-button { font-size: var(--fs-body); font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; }
.sales-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.email-forward > summary, .dialog-toolbar button, .detail-button:not(.inbox-item__link), .icon-button,
.pagination a, .pagination button, .segmented a, input[type=file]::file-selector-button {
  font-size: var(--fs-small) !important; font-weight: 600 !important; border-radius: var(--r) !important;
}
input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--line-2); background: var(--pp-paper); color: var(--ink); cursor: pointer; }

/* Eingabefelder */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  min-height: 40px; border-radius: var(--r) !important; border: 1px solid var(--line-2) !important; background: #fff !important;
  font-size: var(--fs-body) !important; color: var(--ink); padding: 8px 12px;
}
input[type=file] { min-height: 40px; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; font-size: var(--fs-small); width: 100%; }
.inbox-search input { min-height: 0 !important; border: 0 !important; padding: 0 !important; }
input:focus, select:focus, textarea:focus { border-color: var(--mejo-green) !important; box-shadow: 0 0 0 3px var(--accent-wash) !important; outline: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--mejo-green) !important; width: 18px; height: 18px; }

/* Karten und Flächen */
.card, .panel, .figures, .kpis, .sync-panel:not(.inbox .sync-panel), .focused-grid > div, .login-card, .admin-create,
.account-card, .order-preview, .journey-figures {
  background: #fff; border: 1px solid var(--line) !important; border-radius: var(--r-card) !important; box-shadow: none !important;
}
.panel, .account-card, .admin-create { padding: 22px 24px; }
.focused-grid > div { padding: 20px 22px; }
.notes article, .attachments a, .order-candidates li, .email-forward-panel, .journey__facts, .journey__pages, .order-card__list li {
  border-radius: var(--r) !important;
}

/* Tabellen */
th, .rank th { padding: 10px 12px; border-bottom: 1px solid var(--line-2) !important; background: transparent; text-align: left; }
td { font-size: var(--fs-body); border-bottom: 1px solid var(--line); }
td.nowrap, td.num, .rank td.num { font-size: var(--fs-body) !important; }
tbody tr:not(.detail-row):hover { background: #F8F9FA; }

/* Segment-Schalter (Auswertung, Sprache) */
.segmented { border: 1px solid var(--line-2) !important; border-radius: var(--r) !important; overflow: hidden; }
.segmented a[aria-current] { background: var(--graphite) !important; color: #fff !important; }
.lang-switch, .topbar .lang-switch { border-radius: 6px !important; }
.lang-switch button { font-size: var(--fs-meta) !important; font-weight: 600 !important; }

/* Kennzeichen (Status, Bereiche, Punkte) */
.chips span, .status, .due-badge, .ctype, .score, .order-reasons span { font-size: var(--fs-meta) !important; font-weight: 600 !important; letter-spacing: 0 !important; }
.area-chip { font-size: var(--fs-meta) !important; }

/* Seitenrahmen: alle Bereiche gleich breit und gleich eingerückt */
.app .shell, .app .shell.account-shell, .app .shell.admin-shell { max-width: 1400px; margin: 0; padding: 32px 40px 64px; box-sizing: border-box; }
.app .hero, .stats-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 0 0 24px; padding: 0; border: 0; }
.alert { border-radius: var(--r) !important; font-size: var(--fs-body); }

/* Detail als eigene Seite: gleiche Navigation wie überall */
.standalone-back { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 16px; color: var(--ink-2); font-size: var(--fs-small); font-weight: 600; text-decoration: none; }
.standalone-back:hover { color: var(--ink); }
.app.detail-page .standalone-detail { max-width: 1400px; margin: 0; padding: 28px 40px 48px; }

@media (max-width: 1100px) {
  .app .shell, .app .shell.account-shell, .app .shell.admin-shell { padding: 20px 16px 40px; }
  .app.detail-page .standalone-detail { padding: 16px 12px 0; }
  :root { --fs-title: 24px; }
}
@media (max-width: 1100px) {
  .app.detail-page .detail-actionbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 10px; }
}
/* Feldinhalte nie fett (Labels vererben sonst ihr Gewicht) */
input, select, textarea, option { font-weight: 400 !important; }
/* Tabellenköpfe dürfen umbrechen, damit breite Auswertungstabellen nicht abgeschnitten werden */
.stats-page th, .orders-page th, .admin-shell th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.rank th.num { white-space: normal; }
.stats-page table.rank { min-width: 0; }
.rank td:first-child small { white-space: nowrap; }
.inbox-search input[type=search]:not([type=checkbox]) { min-height: 0 !important; height: 40px; border: 0 !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; }
/* 2.24.1: Zahl an „Aktuelle Anfragen“ = neue Anfragen → Grün wie die Kachel „Neu“ */
.sidebar__count, .tabbar__icon em { background: var(--mejo-green-ink) !important; color: #fff !important; }
/* 2.25.0: Zahl wird live aktualisiert; bei 0 ausgeblendet */
[data-new-count][hidden] { display: none !important; }
