/* Digitale Firma app — base styles. Glass design system (CEO 2026-11-13): tokens below,
 * the glass material layer in assets/glass.css, the type bar and the quiet page
 * chrome in assets/template.css. CI = the Baltasaar portal's teal + lime set
 * (values duplicated, no shared code). Light by default; dark on request.
 * No horizontal scroll at 360px. Vanilla — no framework, no build step. */
/* ============================================================
   DESIGN TOKENS — the ONE place (glass design system, CEO 2026-11-13)

   The app is a calm glass product: translucent layered surfaces over a soft
   brand backdrop, hairline borders, large soft radii, depth through quiet
   shadows, one teal authority colour plus the mint "9" mark and lime as the
   accent that has to earn each appearance. Every colour, radius, shadow,
   blur and type step used anywhere in the app is defined here — app.css,
   assets/glass.css, start.css, agent-chat.css and the per-view sheets only
   reference these names. The dark set follows below, twice (device / choice).

   Layers, bottom to top:
     --base          the floor (opaque) + the brand mesh painted on <body>
     --card          resting content surface — translucent, NOT blurred
                     (cards hold long scrolling lists; blur there is costly)
     --glass         blurred chrome: nav rail, top bar, toolbars, tiles
     --glass-strong  blurred overlays: drawer, dialog, palette, popovers
     --card-solid    opaque stand-in wherever something must cover what
                     scrolls beneath it (sticky table heads) and the fallback
                     for browsers without backdrop-filter
   ============================================================ */
:root {
  /* ── brand ── */
  --petrol: #0E5561;            /* surface: carries white text (8.4:1)        */
  --petrol-700: #08333B;
  --petrol-900: #07171A;
  --petrol-50: rgba(14, 85, 97, .10);  /* quiet teal fill: active row, icon chips */
  /* Petrol as TEXT. Same as --petrol in light; they part ways in the dark. */
  --accent-ink: #0E5561;
  --mint: #6cbe86;              /* the "9" mark                                */
  --mint-hi: #8fd6a4;
  --mint-lo: #57ad74;
  --lime: #C8D400;
  --lime-700: #a9b400;
  --lime-ink: #1a1d0c;          /* text ON lime                                */

  /* ── ground + surfaces ── */
  --base: #F2F5F6;
  --card: rgba(255, 255, 255, .78);
  --card-solid: #ffffff;
  --glass: rgba(255, 255, 255, .64);
  --glass-strong: rgba(255, 255, 255, .90);
  --glass-hi: rgba(255, 255, 255, .90);   /* the inner top highlight on glass  */
  --glass-blur: blur(22px) saturate(1.7);
  --th-bg: #F7FAFA;             /* sticky table head — opaque on purpose       */
  --soft: rgba(14, 85, 97, .06);
  --mesh-a: rgba(14, 85, 97, .10);
  --mesh-b: rgba(200, 212, 0, .10);
  --mesh-c: rgba(14, 85, 97, .06);
  /* The brand mesh itself — one definition, painted fixed behind everything. */
  --mesh:
    radial-gradient(52% 44% at 6% 0%, var(--mesh-a), transparent 72%),
    radial-gradient(44% 40% at 98% 96%, var(--mesh-b), transparent 70%),
    radial-gradient(40% 36% at 78% 4%, var(--mesh-c), transparent 72%),
    radial-gradient(46% 40% at 18% 104%, var(--mesh-c), transparent 70%);

  /* ── ink ── */
  --ink: #0E2A32;
  --muted: #48626C;             /* 6.0:1 on the lightest glass                 */
  --line: rgba(14, 42, 50, .11);
  --line-2: rgba(14, 42, 50, .20);

  /* ── status (text tone / soft fill) — every pair is AA on glass ── */
  --success: #23694b;
  --success-soft: rgba(35, 105, 75, .12);
  --danger: #B23030;
  --danger-soft: rgba(168, 58, 42, .11);
  --warn: #8A5200;
  --warn-soft: rgba(217, 138, 0, .15);

  /* ── controls ── */
  --field-bg: rgba(255, 255, 255, .80);
  --btn-bg: rgba(255, 255, 255, .72);
  --star: #9a6f00;
  --notice-info-line: rgba(14, 85, 97, .20);
  --notice-warn-line: rgba(217, 138, 0, .32);
  --notice-error-line: rgba(168, 58, 42, .26);
  --notice-ok-line: rgba(35, 105, 75, .26);
  --toast-bg: rgba(10, 30, 34, .90);
  --toast-ink: #ffffff;
  --scrim: rgba(9, 28, 33, .34);     /* behind the drawer, the dialog, the nav */
  --tint: rgba(14, 85, 97, .07);     /* the row that is currently open         */
  --focus-soft: rgba(14, 85, 97, .22);

  /* ── the nav rail (kept as their own names: the rail may sit on another
        material than the content) ── */
  --side-bg: rgba(255, 255, 255, .60);
  --side-ink: #0E2A32;
  --side-ink-strong: #08333B;
  --side-ink-dim: #48626C;
  --side-ink-faint: #5E7780;
  --side-icon: #0E5561;
  --side-disabled: #7d8f93;
  --side-disabled-icon: #9aabaf;
  --side-line: rgba(13, 58, 68, .12);
  --side-hover: rgba(14, 85, 97, .07);

  /* ── shape, depth, motion ── */
  --radius: 16px;               /* cards, tiles, panels                        */
  --radius-sm: 10px;            /* controls: buttons, fields, rows             */
  --radius-lg: 22px;            /* rail, drawer, dialog, palette               */
  --shadow: 0 1px 1px rgba(11, 68, 80, .04), 0 12px 32px -16px rgba(11, 68, 80, .20);
  --shadow-float: 0 2px 6px rgba(11, 68, 80, .06), 0 28px 70px -24px rgba(11, 68, 80, .34);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: .18s;

  /* ── type: the system UI stack, as in the portal CI ── */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-large: 28px;             /* large title                                 */
  --fs-title: 20px;
  --fs-head: 15px;
  --fs-body: 14px;
  --fs-sub: 13px;
  --fs-cap: 12px;

  /* The focus ring. One definition, used by every interactive element. */
  --ring: 0 0 0 2px var(--card-solid), 0 0 0 4px var(--accent-ink);

  /* ── z-index scale ──────────────────────────────────────────────────────
     Documented once so nothing has to guess a number again. Every value in
     this stylesheet comes from here; do not invent intermediate levels.
       10  in-flow sticky bits inside the content column
       20  the topbar
       25  the mobile nav backdrop
       30  the off-canvas sidebar
       40  type-ahead dropdowns + table popovers (must clear their card)
       45  the drawer backdrop
       50  the drawer itself
       55  the modal dialog backdrop
       58  the modal dialog
       60  toasts — always the top-most thing on screen               */
  --z-sticky: 10;
  --z-topbar: 20;
  --z-nav-backdrop: 25;
  --z-nav: 30;
  --z-dropdown: 40;
  --z-drawer-back: 45;
  --z-drawer: 50;
  --z-dialog-back: 55;
  --z-dialog: 58;
  --z-toast: 60;
  /* ── type bar + the template components (assets/template.css) ── */
  --ink-soft: #23414A;          /* body copy one step under --ink               */
  --dim: #5E7780;               /* quiet meta text                              */
  --track: #DCE5E7;             /* the empty part of bars and segments          */
  --focus-line: #0E5561;        /* focused field / type bar                     */
  --bar-bg: rgba(255, 255, 255, .92);
  --bar-line: rgba(14, 42, 50, .14);
  --bar-shadow: 0 1px 2px rgba(14, 42, 50, .05), 0 18px 44px -18px rgba(14, 85, 97, .30);
  --chip-bg: rgba(255, 255, 255, .80);
  --chip-bg-hover: #ffffff;
  --chip-line: rgba(14, 42, 50, .13);
  --tile-bg: var(--card);
  --tile-line: var(--line);
  --tile-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
}

/* ============================================================
   DARK THEME (CEO 2026-10-14, glass 2026-11-13)
   · It follows the DEVICE, and a switch in the app overrides it. That is why
     the set appears twice: once under the media query guarded by
     `:not([data-theme="light"])` and once under `[data-theme="dark"]`.
     `theme.js` only ever sets that attribute.
   · The ground is a teal-tinted near-black, like digitalefirma.com; surfaces are
     LIGHTER than the floor (in the dark, light means "closer").
   Keep both blocks identical.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --petrol: #157e92;        /* surface: still carries white text (4.6:1)    */
    --petrol-700: #11697a;
    --petrol-900: #07171A;
    --petrol-50: rgba(123, 209, 223, .14);
    --accent-ink: #7BD1DF;    /* petrol as text on a dark page (8.2:1)        */
    --lime: #d2dc4f;
    --lime-700: #dde76a;

    --base: #0A1417;
    --card: rgba(255, 255, 255, .05);
    --card-solid: #101F24;
    --glass: rgba(16, 31, 36, .62);
    --glass-strong: rgba(16, 31, 36, .92);
    --glass-hi: rgba(255, 255, 255, .09);
    --glass-blur: blur(24px) saturate(1.5);
    --th-bg: #12262C;
    --soft: rgba(255, 255, 255, .065);
    --mesh-a: rgba(21, 126, 146, .20);
    --mesh-b: rgba(200, 212, 0, .06);
    --mesh-c: rgba(123, 209, 223, .07);

    --ink: #E7EEF0;
    --muted: #9DB3BA;
    --line: rgba(255, 255, 255, .10);
    --line-2: rgba(255, 255, 255, .18);

    --success: #6fd0a4;
    --success-soft: rgba(79, 185, 139, .16);
    --danger: #F19A9A;
    --danger-soft: rgba(224, 112, 92, .17);
    --warn: #E8C06A;
    --warn-soft: rgba(224, 165, 58, .16);

    --field-bg: rgba(0, 0, 0, .26);
    --btn-bg: rgba(255, 255, 255, .075);
    --star: #e0b253;
    --notice-info-line: rgba(123, 209, 223, .26);
    --notice-warn-line: rgba(224, 165, 58, .32);
    --notice-error-line: rgba(224, 112, 92, .32);
    --notice-ok-line: rgba(79, 185, 139, .30);
    --toast-bg: rgba(231, 238, 240, .95);
    --toast-ink: #0A1417;
    --scrim: rgba(0, 0, 0, .58);
    --tint: rgba(123, 209, 223, .10);
    --focus-soft: rgba(123, 209, 223, .30);

    --side-bg: rgba(16, 31, 36, .62);
    --side-ink: #E7EEF0;
    --side-ink-strong: #ffffff;
    --side-ink-dim: #9DB3BA;
    --side-ink-faint: #8AA1A8;
    --side-icon: #7BD1DF;
    --side-disabled: #6d8086;
    --side-disabled-icon: #55676c;
    --side-line: rgba(255, 255, 255, .09);
    --side-hover: rgba(255, 255, 255, .06);

    --shadow: 0 1px 1px rgba(0, 0, 0, .30), 0 14px 34px -16px rgba(0, 0, 0, .60);
    --shadow-float: 0 2px 6px rgba(0, 0, 0, .35), 0 30px 80px -24px rgba(0, 0, 0, .80);
    --ink-soft: #C9D6DA;
    --dim: #8AA1A8;
    --track: #1F3A43;
    --focus-line: #7BD1DF;
    --bar-bg: rgba(18, 38, 44, .92);
    --bar-line: rgba(255, 255, 255, .14);
    --bar-shadow: 0 18px 48px -18px rgba(0, 0, 0, .70);
    --chip-bg: rgba(255, 255, 255, .06);
    --chip-bg-hover: rgba(255, 255, 255, .11);
    --chip-line: rgba(255, 255, 255, .12);
  }
}

:root[data-theme="dark"] {
  --petrol: #157e92;
  --petrol-700: #11697a;
  --petrol-900: #07171A;
  --petrol-50: rgba(123, 209, 223, .14);
  --accent-ink: #7BD1DF;
  --lime: #d2dc4f;
  --lime-700: #dde76a;

  --base: #0A1417;
  --card: rgba(255, 255, 255, .05);
  --card-solid: #101F24;
  --glass: rgba(16, 31, 36, .62);
  --glass-strong: rgba(16, 31, 36, .92);
  --glass-hi: rgba(255, 255, 255, .09);
  --glass-blur: blur(24px) saturate(1.5);
  --th-bg: #12262C;
  --soft: rgba(255, 255, 255, .065);
  --mesh-a: rgba(21, 126, 146, .20);
  --mesh-b: rgba(200, 212, 0, .06);
  --mesh-c: rgba(123, 209, 223, .07);

  --ink: #E7EEF0;
  --muted: #9DB3BA;
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .18);

  --success: #6fd0a4;
  --success-soft: rgba(79, 185, 139, .16);
  --danger: #F19A9A;
  --danger-soft: rgba(224, 112, 92, .17);
  --warn: #E8C06A;
  --warn-soft: rgba(224, 165, 58, .16);

  --field-bg: rgba(0, 0, 0, .26);
  --btn-bg: rgba(255, 255, 255, .075);
  --star: #e0b253;
  --notice-info-line: rgba(123, 209, 223, .26);
  --notice-warn-line: rgba(224, 165, 58, .32);
  --notice-error-line: rgba(224, 112, 92, .32);
  --notice-ok-line: rgba(79, 185, 139, .30);
  --toast-bg: rgba(231, 238, 240, .95);
  --toast-ink: #0A1417;
  --scrim: rgba(0, 0, 0, .58);
  --tint: rgba(123, 209, 223, .10);
  --focus-soft: rgba(123, 209, 223, .30);

  --side-bg: rgba(16, 31, 36, .62);
  --side-ink: #E7EEF0;
  --side-ink-strong: #ffffff;
  --side-ink-dim: #9DB3BA;
  --side-ink-faint: #8AA1A8;
  --side-icon: #7BD1DF;
  --side-disabled: #6d8086;
  --side-disabled-icon: #55676c;
  --side-line: rgba(255, 255, 255, .09);
  --side-hover: rgba(255, 255, 255, .06);

  --shadow: 0 1px 1px rgba(0, 0, 0, .30), 0 14px 34px -16px rgba(0, 0, 0, .60);
  --shadow-float: 0 2px 6px rgba(0, 0, 0, .35), 0 30px 80px -24px rgba(0, 0, 0, .80);
  --ink-soft: #C9D6DA;
  --dim: #8AA1A8;
  --track: #1F3A43;
  --focus-line: #7BD1DF;
  --bar-bg: rgba(18, 38, 44, .92);
  --bar-line: rgba(255, 255, 255, .14);
  --bar-shadow: 0 18px 48px -18px rgba(0, 0, 0, .70);
  --chip-bg: rgba(255, 255, 255, .06);
  --chip-bg-hover: rgba(255, 255, 255, .11);
  --chip-line: rgba(255, 255, 255, .12);
}

/* No backdrop-filter (older browsers, some embedded webviews): the glass
   would be see-through without the blur that makes it legible, so every
   translucent surface falls back to its solid stand-in. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass: var(--card-solid);
    --glass-strong: var(--card-solid);
    --side-bg: var(--card-solid);
  }
}

/* The browser's own widgets — scrollbars, the date picker, autofill — follow
   this, so they stop being bright white rectangles on a dark page. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }


* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--base);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--accent-ink); }
button { font-family: inherit; }

/* ---- Boot splash ---- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; gap: 20px; }
.boot-mark { font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: .04em; color: var(--accent-ink); }
.boot-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent-ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   LOGIN
   ============================================================ */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 120% at 50% 0%, #0e5561 0%, #0b4450 45%, #07171A 100%); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 16px; box-shadow: 0 24px 60px rgba(7, 23, 26, .35); overflow: hidden; }
.auth-head { padding: 34px 32px 8px; }
.auth-mark { font-family: var(--serif); font-weight: 600; font-size: 28px; color: var(--accent-ink); letter-spacing: .03em; }
.auth-mark .dot { color: var(--lime); }
.auth-head h1 { font-size: 20px; margin: 18px 0 6px; font-weight: 700; }
.auth-head p { color: var(--muted); font-size: 14px; margin: 0; }
.auth-body { padding: 20px 32px 34px; }
.auth-body label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.field {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1.5px solid var(--line-2); border-radius: 10px;
  background: var(--field-bg); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-50); }
.auth-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; text-align: center; }
.auth-err { background: var(--danger-soft); color: var(--danger); font-size: 13px; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.auth-ok { text-align: center; padding: 8px 0 4px; }
.auth-ok .ok-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; margin: 0 auto 18px; }
.auth-ok .ok-ic svg { width: 26px; height: 26px; }
.auth-ok h2 { font-size: 19px; margin: 0 0 8px; }
.auth-ok p { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.auth-ok .em { color: var(--ink); font-weight: 600; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; font-size: 14px; font-weight: 600; border-radius: 10px;
  border: 1.5px solid var(--line-2); background: var(--btn-bg); color: var(--ink); cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap;
  /* 44px is the smallest reliable finger target; below it taps land next to the
     button instead of on it. Applies app-wide, small variants included. */
  min-height: 44px;
}
.btn:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn.primary:hover { background: var(--petrol-700); border-color: var(--petrol-700); color: #fff; }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--petrol-900); }
.btn.lime:hover { background: var(--lime-700); border-color: var(--lime-700); color: var(--petrol-900); }
.btn.block { width: 100%; padding: 13px 16px; font-size: 15px; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; min-height: 36px; }
/* Small buttons stay visually small but keep a finger-sized target on touch. */
@media (pointer: coarse) { .btn.sm { min-height: 44px; } }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); border-color: transparent; color: var(--ink); }
.btn svg { width: 16px; height: 16px; }

.page-head {
  padding: 26px 32px 18px; border-bottom: 1px solid var(--line); background: var(--card);
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
}
.page-head-text { flex: 1 1 260px; min-width: 0; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; max-width: 72ch; }
.content { padding: 24px 32px 48px; flex: 1; min-width: 0; }

/* Backdrop for mobile nav */
.backdrop { display: none; position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-nav-backdrop); }
.backdrop.open { display: block; }

/* ============================================================
   CARDS / TABLES / FORMS
   ============================================================ */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .count { margin-left: auto; font-size: 12.5px; color: var(--muted); background: var(--soft); padding: 3px 10px; border-radius: 20px; }
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.card-head .count + .card-head-actions { margin-left: 0; }
.card-head h4 { margin: 0; font-size: 14px; font-weight: 700; }
.section-title { font-size: 17px; margin: 32px 0 14px; font-weight: 700; }

/* The ONE toolbar layout: primary actions left, filters right, stacking on a
   phone. Before Modul 0 every module inlined its own flex row here. */
.toolbar {
  display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.toolbar .spacer { flex: 1; }
.toolbar-main { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .filter-row { margin-left: auto; }

/* The ONE filter row. Replaces the eight hand-rolled inline-styled flex rows. */
.filter-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; min-width: 0;
}
.filter-row > .btn { align-self: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 0 1 auto; }
.filter-field .filter-label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.filter-field .field { min-width: 0; width: auto; }
.filter-field input[data-wide] { min-width: 200px; }
.filter-row .form-field { margin: 0; flex: 0 1 auto; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr.blocked td { background: var(--danger-soft); }
.cell-name { font-weight: 600; }
.cell-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.pill .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--success-soft); color: var(--success); }
.pill.gray { background: var(--soft); color: var(--muted); }
.pill.blue { background: var(--petrol-50); color: var(--accent-ink); }
.pill.gold { background: var(--warn-soft); color: var(--warn); }
.pill.red { background: var(--danger-soft); color: var(--danger); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.form-field input, .form-field select, .form-field textarea {
  padding: 10px 12px; font-size: 14px; border: 1.5px solid var(--line-2); border-radius: 9px;
  background: var(--field-bg); color: var(--ink); outline: none; width: 100%; font-family: inherit;
}
/* Textareas were the one control with no styling at all — they inherited the
   browser default and looked like a different product. */
.form-field textarea, textarea.field {
  line-height: 1.5; resize: vertical; min-height: 72px; font-family: inherit; font-size: 14px;
  padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 9px; background: var(--field-bg);
  color: var(--ink); width: 100%; outline: none;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
textarea.field:focus, .field:focus {
  border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-50);
}
.form-field input:disabled, .form-field select:disabled, .form-field textarea:disabled,
.form-field input[readonly] { background: var(--soft); color: var(--muted); cursor: not-allowed; }
.form-field .req { color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }

/* Inline validation lives UNDER the field it belongs to. A toast cannot point
   at an input, so every field carries its own error slot. */
.field-help { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.field-error { margin: 0; font-size: 12.5px; color: var(--danger); font-weight: 600; min-height: 0; }
.field-error:empty { display: none; }
.is-invalid { border-color: var(--danger) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-soft) !important; }

/* Empty / error states */
.empty { text-align: center; padding: 48px 20px; }
.empty .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--petrol-50); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .ic svg { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 8px; font-size: 16px; }
.empty p { color: var(--muted); max-width: 380px; margin: 0 auto 20px; font-size: 14px; }

/* File upload row */
.upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload input[type=file] { font-size: 13px; color: var(--muted); max-width: 100%; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg); color: var(--toast-ink); padding: 12px 20px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 12px 30px rgba(7, 23, 26, .35); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: var(--z-toast); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* Coming-soon placeholder view */
.soon-view { text-align: center; padding: 60px 20px; }
.soon-view .ic { width: 64px; height: 64px; border-radius: 18px; background: var(--petrol-50); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto 18px; }
.soon-view .ic svg { width: 30px; height: 30px; }
.soon-view h2 { margin: 0 0 10px; font-size: 20px; }
.soon-view p { color: var(--muted); max-width: 420px; margin: 0 auto; font-size: 14.5px; }
.soon-view .tag { display: inline-block; margin-bottom: 18px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--warn-soft); color: var(--warn); padding: 5px 12px; border-radius: 20px; }

/* ============================================================
   LEADS — tabs, Lead-Finder, drawer, score card, type-ahead, Telegram
   ============================================================ */
.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1.5px solid var(--line); padding-bottom: 8px; }
.tabs .spacer { flex: 1; }
.tab { background: transparent; border: none; padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; }
.tab:hover { background: var(--soft); color: var(--ink); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); }
.tab.active { background: var(--petrol); color: #fff; }

.finder-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.finder-go .btn { width: 100%; }
.finder-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--petrol); }

/* type-ahead dropdown (city autocomplete + deal picker) */
.ac-wrap { position: relative; min-width: 0; }
.ac-wrap input { width: 100%; }
.ac-list { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: var(--z-dropdown); background: var(--card);
  border: 1.5px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.ac-list.open { display: block; }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: 14px; min-width: 0; }
.ac-item + .ac-item { border-top: 1px solid var(--line); }
.ac-item:hover, .ac-item.active { background: var(--petrol-50); }
.ac-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ac-txt small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.ac-score { font-weight: 700; color: var(--accent-ink); font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; max-width: 100%; background: var(--petrol-50); color: var(--accent-ink);
  border-radius: 20px; padding: 5px 6px 5px 12px; font-size: 13px; overflow-wrap: anywhere; }
.chip button { border: none; background: transparent; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 6px; }

/* result cards (no table → no horizontal scroll on phones) */
.fr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.fr-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; background: var(--card); min-width: 0;
  transition: border-color .15s, box-shadow .15s; }
.fr-card:hover, .fr-card:focus { border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-50); outline: none; }
.fr-card.is-lead { background: var(--success-soft); }
.fr-top { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 4px; }
.fr-name { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.fr-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.fr-meta { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; margin-top: 2px; }
.fr-addr { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; margin-top: 2px; }
.stars { color: var(--star); font-weight: 600; }
.no-web { color: var(--danger); font-weight: 600; }

/* detail drawer — right side on desktop, full width on phones */
body.drawer-open { overflow: hidden; }
.drawer-back { position: fixed; inset: 0; background: rgba(7, 23, 26, .45); z-index: var(--z-drawer-back); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--card); z-index: var(--z-drawer);
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(7, 23, 26, .25); }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0 0 6px; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.drawer-head h3 { margin: 0 0 4px; font-size: 17px; overflow-wrap: anywhere; }
.drawer-head-text { flex: 1; min-width: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; font-size: 14px; overflow-wrap: anywhere; }
.drawer-body h4 { margin: 18px 0 8px; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.imp-box { background: var(--soft); border-radius: 10px; padding: 12px; }
.imp-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.boot-spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; }
.hours, .reviews { list-style: none; padding: 0; margin: 0; }
.hours li { font-size: 13px; padding: 2px 0; }
.reviews li { border-top: 1px solid var(--line); padding: 10px 0; }
.reviews p { margin: 4px 0 0; font-size: 13.5px; }
.rv-head { font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; }

/* portal-style score card in the lead panel */
.score-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; margin: 0 0 14px; background: var(--base); }
.sc-main { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.sc-num { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 700; background: var(--soft); color: var(--muted); }
.sc-num.green { background: var(--success-soft); color: var(--success); }
.sc-num.gold { background: var(--warn-soft); color: var(--warn); }
.sc-sub { color: var(--muted); font-size: 12.5px; }
.sc-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.sc-bar span { font-size: 13px; font-weight: 600; }
.sc-bar small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.bar { height: 7px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--petrol); }
.sc-facts { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.sc-checks { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.sc-checks li.ok span { color: var(--success); font-weight: 700; }
.sc-checks li.no { color: var(--muted); }
.sc-checks li.no span { color: var(--danger); font-weight: 700; }
.sc-next { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13.5px; }

/* toast with action links */
.toast.rich { pointer-events: auto; }
.toast-links { display: inline-flex; gap: 14px; margin-left: 12px; flex-wrap: wrap; }
.toast-links a { color: var(--lime); font-weight: 600; }

/* Telegram card */
.tg-code { background: var(--soft); border-radius: 10px; padding: 12px; margin-top: 12px; display: grid; gap: 8px; justify-items: start; }
.tg-link { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; max-width: 100%; }
.tg-code small { color: var(--muted); }
.tg-links { list-style: none; padding: 0; margin: 0; }
.tg-links li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }

/* ============================================================
   RESPONSIVE — no horizontal scroll at 400px
   ============================================================ */
@media (max-width: 860px) {
  .page-head { padding: 20px 16px 14px; }
  .content { padding: 18px 16px 40px; }
}
@media (max-width: 720px) {
  .finder-form { grid-template-columns: 1fr; }
  .sc-bars { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .page-head h1 { font-size: 19px; }
  .content { padding: 16px 14px 36px; }
}

/* ============================================================
   MODUL 0 — the shared component kit (core/ui.js)
   Everything below is rendered by exactly one function in ui.js, so a change
   here changes every module at once. That is the point.
   ============================================================ */

/* ---- utilities ---- */
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.spacer-16 { height: 16px; }
.inline-link { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.inline-link:hover { text-decoration: underline; }
.term { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: var(--z-toast);
  background: var(--petrol); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }
.tag {
  display: inline-block; background: var(--soft); color: var(--ink); border-radius: 6px;
  padding: 2px 8px; font-size: 12.5px; margin: 0 4px 4px 0;
}

/* ---- notice block ---- */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  margin-bottom: 18px; border: 1px solid var(--line); background: var(--card); font-size: 14px;
}
/* Sized wherever it appears, not only inside .notice — the account tab puts one
   in a plain paragraph, and a rule that never matched left it page-sized. */
.notice-ic { flex: 0 0 auto; width: 20px; height: 20px; display: inline-flex; vertical-align: -4px; }
.notice-ic svg { width: 20px; height: 20px; }
.notice .notice-text { min-width: 0; }
.notice .notice-text b { display: block; margin-bottom: 2px; }
.notice .notice-text p { margin: 0 0 8px; color: var(--muted); }
.notice .notice-text p:last-child { margin-bottom: 0; }
.notice.info { background: var(--petrol-50); border-color: var(--notice-info-line); color: var(--ink); }
.notice.info .notice-ic { color: var(--accent-ink); }
.notice.warn { background: var(--warn-soft); border-color: var(--notice-warn-line); }
.notice.warn .notice-ic { color: var(--warn); }
.notice.error { background: var(--danger-soft); border-color: var(--notice-error-line); }
.notice.error .notice-ic { color: var(--danger); }
.notice.ok { background: var(--success-soft); border-color: var(--notice-ok-line); }
.notice.ok .notice-ic { color: var(--success); }

/* ---- tiles (Heute + Pipeline) ---- */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 12px; margin-bottom: 20px;
}
.tile {
  display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; cursor: pointer; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--petrol); }
.tile:focus-visible { outline: none; box-shadow: var(--ring); }
.tile.is-static { cursor: default; }
.tile.is-static:hover { border-color: var(--line); }
.tile-ic { width: 20px; height: 20px; color: var(--accent-ink); margin-bottom: 4px; }
.tile-ic svg { width: 20px; height: 20px; }
.tile-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tile-value { font-size: 24px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tile-sub { font-size: 12.5px; color: var(--muted); }

/* ---- skeletons ---- */
.sk { display: block; height: 12px; border-radius: 6px; background: var(--soft); animation: pulse 1.4s ease-in-out infinite; }
.sk-sm { width: 45%; height: 10px; margin: 2px 0; }
.sk-lg { width: 70%; height: 22px; margin: 6px 0; }
.sk-row td { padding: 14px 12px; }
.tile.is-loading { cursor: default; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---- "Das steht heute an" ---- */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda-row + .agenda-row { border-top: 1px solid var(--line); }
.agenda-hit {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: transparent; border: none; padding: 12px 8px; cursor: pointer;
  font-family: inherit; font-size: 14px; color: inherit; border-radius: 9px;
}
.agenda-hit:hover { background: var(--soft); }
.agenda-hit:focus-visible { outline: none; box-shadow: var(--ring); }
.agenda-ic { flex: 0 0 auto; width: 20px; height: 20px; color: var(--accent-ink); }
.agenda-ic svg { width: 20px; height: 20px; }
.agenda-text { flex: 1; min-width: 0; }
.agenda-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.agenda-meta { display: block; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.agenda-due { flex: 0 0 auto; }

/* ---- table + the phone card list ---- */
.cell-strong { font-weight: 600; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .btn + .btn { margin-left: 6px; }
table.tbl tbody tr.row-click { cursor: pointer; }
table.tbl tbody tr.row-click:hover td { background: var(--soft); }
table.tbl tbody tr.row-click:focus-visible { outline: none; box-shadow: inset var(--ring); }
table.tbl.matrix th, table.tbl.matrix td { white-space: nowrap; }

/* The phone rendering of the SAME rows: cards, so nothing scrolls sideways. */
.card-list { display: none; }
.row-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--card);
  min-width: 0; margin-bottom: 10px;
}
.row-card.row-click, .row-card[role="button"] { cursor: pointer; }
.row-card[role="button"]:focus-visible { outline: none; box-shadow: var(--ring); }
.row-card.blocked { background: var(--danger-soft); }
.rc-title { font-weight: 700; margin-bottom: 8px; overflow-wrap: anywhere; }
.rc-title small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.rc-body { display: grid; gap: 4px; margin: 0; }
.rc-kv { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; font-size: 13.5px; }
.rc-kv dt { color: var(--muted); flex: 0 0 auto; }
.rc-kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.rc-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- pagination ---- */
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.pager-state { font-size: 13px; color: var(--muted); }

/* ---- status control ---- */
.status-control { display: inline-flex; min-width: 0; }
.status-control select { min-width: 150px; padding: 8px 10px; font-size: 13.5px; }

/* ---- key/value list (drawer facts) ---- */
.kv-list { display: grid; gap: 2px; margin: 0 0 18px; }
.kv-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 6px 14px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: none; }
.kv-row dt { color: var(--muted); font-size: 13px; }
.kv-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv-row dd small { display: block; color: var(--muted); font-size: 12px; }

/* ---- drawer additions ---- */
.drawer-badge { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.drawer-sub { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.drawer-x { flex: 0 0 auto; min-width: 44px; min-height: 44px; }
.drawer-x svg { width: 18px; height: 18px; }
.drawer-section { margin-top: 22px; }
.drawer-section h3 { font-size: 15px; margin: 0 0 6px; font-weight: 700; }
.drawer-section h4 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.drawer-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.drawer-actions .btn { flex: 1 1 auto; }
.link-list { list-style: none; margin: 0 0 10px; padding: 0; }
.link-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.link-list li:last-child { border-bottom: none; }

/* ---- modal dialog (replaces window.confirm / window.prompt) ---- */
.dialog-back { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-dialog-back); }
.dialog {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--card); border-radius: 16px; padding: 24px; z-index: var(--z-dialog);
  box-shadow: 0 24px 60px rgba(7, 23, 26, .35);
}
.dialog h2 { margin: 0 0 10px; font-size: 18px; }
.dialog-body p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }

/* ---- inline panels + forms inside cards ---- */
.card.panel { margin-bottom: 20px; }
.panel-inline { background: var(--base); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0 14px; }
.inline-form .form-field { margin: 0; flex: 1 1 180px; min-width: 0; }
.inline-form .form-field:first-child { flex: 0 0 auto; }
.line-row { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.line-row:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.line-actions { margin-top: 8px; }
.totals { display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; font-size: 14px; }
.totals .ok { color: var(--success); font-weight: 600; }
.booking-lines { margin-top: 5px; display: grid; gap: 2px; }
.booking-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.import-result { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.import-result h4 { margin: 0 0 10px; font-size: 14px; }

/* ---- contact pickers ---- */
.picker { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; background: var(--base); }
.picker-list { max-height: 280px; overflow-y: auto; display: grid; gap: 2px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--petrol); flex: 0 0 auto; }
.check-row input:focus-visible { outline: none; box-shadow: var(--ring); }


/* ---- empty/error state icon tones ---- */
.empty .ic.warn { background: var(--warn-soft); color: var(--warn); }
.empty .btn { margin: 0 auto; }

/* ---- ac-list items are now delegated buttons, not mousedown hacks ---- */
.ac-item:focus-visible { outline: none; background: var(--petrol-50); }

/* ============================================================
   RESPONSIVE — the table→card switch and the phone gutters.
   Verified at 375px, 768px and 1440px: no horizontal page scroll.
   ============================================================ */
@media (max-width: 720px) {
  .toolbar { align-items: stretch; }
  .toolbar .filter-row { margin-left: 0; }
  .toolbar-main .btn, .filter-row > .btn { flex: 1 1 auto; }
  .filter-field { flex: 1 1 160px; }
  .filter-field .field { width: 100%; }
  .filter-field input[data-wide] { min-width: 0; }
}
@media (max-width: 620px) {
  /* Below this width a table cannot hold six columns without scrolling
     sideways, which is a hard no-go. The SAME rows render as cards instead. */
  .table-wrap { display: none; }
  .card-list { display: block; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 13px; }
  .tile-value { font-size: 20px; }
  .kv-row { grid-template-columns: 1fr; gap: 2px; }
  .page-head { padding: 18px 16px 14px; }
  .content { padding: 16px 16px 36px; }
  .inline-form .form-field, .inline-form .form-field:first-child { flex: 1 1 100%; }
  .status-control select { min-width: 0; width: 100%; }
  .drawer-actions .btn { flex: 1 1 100%; }
  .pager { justify-content: space-between; }
}
@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr; }
}

/* ============================================================
   VERTRIEB-TIEFE (2026-09-20) — Auswahlleiste, gespeicherte Filter,
   Phasen-Tafel und die Weiterverwenden-Kacheln. Alles hier hält sich an
   die bestehenden Tokens; nichts davon scrollt bei 375 px seitwärts.
   ============================================================ */

/* ── Zeilenauswahl + Mehrfachaktionen ─────────────────────────────────── */
/* Die Checkbox ist ein 44-px-Ziel, auch wenn das Kästchen kleiner aussieht —
   sonst trifft man auf dem Handy die Zeile statt der Auswahl. */
.row-select { display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin: -10px 0; cursor: pointer; }
.row-select input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--petrol); cursor: pointer; }
.row-select input:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }

.bulk-bar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--petrol-50); border: 1.5px solid var(--petrol);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px;
}
.bulk-count { font-size: 14px; color: var(--accent-ink); padding-bottom: 10px; }
.bulk-bar .filter-field { flex: 1 1 200px; min-width: 0; }
.bulk-bar .field { min-height: 44px; }
.bulk-bar .btn { min-height: 44px; }

/* ── gespeicherte Filter ──────────────────────────────────────────────── */
.preset-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.preset-label { font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; }
.preset-bar .chip { margin-top: 0; }
.preset-bar .chip .inline-link { color: inherit; }
.preset-bar .chip button { min-width: 32px; min-height: 32px; }

/* ── Phasen-Tafel ─────────────────────────────────────────────────────── */
/* auto-fill + minmax heißt: so viele Spalten wie passen. Auf dem Handy ist das
   genau eine — die Tafel wird zur Liste statt zu einem Seitwärts-Scroller. */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.board-col { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.board-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.board-count { font-weight: 700; font-size: 14px; }
.board-sum { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.board-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; min-width: 0; }
.board-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none;
  overflow-wrap: anywhere; min-height: 24px; }
.board-title:hover { color: var(--accent-ink); text-decoration: underline; }
.board-title:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }
.board-meta { font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.board-meta.muted { color: var(--muted); }
.board-move { margin-top: 8px; }
.board-move .status-control { display: block; }
.board-move .status-control select { width: 100%; min-width: 0; min-height: 44px; }
.board-empty { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

/* Überfällige Aufgaben tragen ihre Dringlichkeit am Rand, nicht in Großbuchstaben. */
.card.bucket-overdue { border-left: 4px solid var(--danger); }

/* Eine Kachel, die verlinkt, bleibt eine Kachel — kein unterstrichener Link. */
a.tile { text-decoration: none; color: inherit; }
a.tile:hover .tile-value { color: var(--accent-ink); }
a.tile:focus-visible { outline: none; box-shadow: var(--ring); }

/* ── Weiterverwenden (Lead → Kontakt / Deal) ──────────────────────────── */
.next-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.next-step { border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.next-step b { display: block; margin-bottom: 4px; }
.next-step .hint { margin: 0 0 10px; }
.next-step .btn { min-height: 44px; }

/* Ein eingestelltes Produkt bleibt lesbar, tritt aber zurück. */
tr.muted-row .cell-name, .row-card.muted-row .rc-title { opacity: .72; }

@media (max-width: 620px) {
  /* Auf dem Handy wird getippt, nicht geklickt: jedes Bedienelement bekommt die
     44 px Trefferfläche, die ein Daumen braucht — auch die kleinen Zeilen- und
     Dialogknöpfe, die am Schreibtisch mit 40 px auskommen. */
  .btn, .btn.sm, .field, select.field, .tab { min-height: 44px; }
  .bulk-bar { position: sticky; bottom: 0; z-index: 10; }
  .bulk-bar .filter-field, .bulk-bar .btn { flex: 1 1 100%; }
  .bulk-count { flex: 1 1 100%; padding-bottom: 0; }
  .board { grid-template-columns: 1fr; }
  .next-steps { grid-template-columns: 1fr; }
}

/* ============================================================
   REDUCED MOTION — honour the OS setting. Nothing that only decorates
   should move for someone who asked for less movement.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .boot-spinner { animation: none; border-top-color: var(--petrol); }
  .sk { animation: none; opacity: .7; }
  .side { transition: none; }
}

/* Columns a table marks as secondary (`hideOnPhone`) disappear below 900px.
   The kit swaps to cards under 620px, so this rule governs the tablet band in
   between — where a wide table used to scroll sideways inside its wrapper. */
@media (max-width: 900px) {
  .hide-phone { display: none; }
}

/* ============================================================
   BRIEFING (Modul 9) — Tageslage, Quellen, Abonnenten, Newsletter.
   Vier Klassen, alle von js/views/briefing.js gerendert. Die Lage ist
   Lesestoff, nicht ein Formular: der Fließtext darf größer sein als eine
   Tabellenzeile, und die belegten Zeilen stehen als schlichte Liste darunter.
   ============================================================ */
.lead-text { font-size: 16.5px; line-height: 1.6; color: var(--ink); margin: 0 0 18px; }
.plain-list { list-style: none; margin: 0 0 18px; padding: 0; }
.plain-list li { padding: 9px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.field-label-inline { font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.lead-text + .field-label-inline { margin-top: 18px; }
.prose-preview { color: var(--ink); line-height: 1.6; }
.prose-preview p { margin: 0 0 12px; }
.prose-preview p:last-child { margin-bottom: 0; }
/* Die Lage, die gerade oben steht, ist in der Verlaufsliste markiert. */
.tbl tr.is-open { background: var(--tint); }
.tbl tr.is-open .cell-name { font-weight: 700; }

/* ============================================================
   SHELL 2026-11-13 — Navigationsleiste wie im Baltasaar-Portal
   (Cloudflare-Stil), ruhige Flaechen wie in Vertriebs-Werkzeugen:
   eine schwebende, helle Leiste auf der Grundflaeche, Abschnitte mit
   Lime-Kerbe, Unterseiten an einer Baumlinie, aktiver Punkt.
   Im Dunkeln dieselbe Ordnung eine Stufe tiefer (Tokens oben).
   Gerendert von js/shell.js, Baum in js/core/nav.js.
   ============================================================ */
:root { --rail-w: 256px; --rail-gap: 8px; }

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.main { min-width: 0; display: flex; flex-direction: column; }
#view { min-width: 0; flex: 1; display: flex; flex-direction: column; }
#view:focus { outline: none; }

/* ---- die Leiste ---- */
.rail {
  position: sticky; top: var(--rail-gap); align-self: start;
  height: calc(100vh - 2 * var(--rail-gap)); height: calc(100dvh - 2 * var(--rail-gap));
  margin: var(--rail-gap) 0 var(--rail-gap) var(--rail-gap);
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  box-shadow: 0 1px 2px rgba(11, 68, 80, .04);
}
.rail-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 8px 12px; }
.rail-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-decoration: none; color: inherit; padding: 4px; border-radius: 10px; }
.rail-brand:hover { background: var(--soft); }
.rail-brand:focus-visible { outline: none; box-shadow: var(--ring); }
.rail-logo { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; background: var(--petrol); color: #fff;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 19px; position: relative; }
.rail-logo::after { content: ""; position: absolute; right: 5px; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.rail-brand-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rail-brand-txt b { font-family: var(--serif); font-weight: 600; font-size: 17px; color: var(--accent-ink); letter-spacing: .02em; }
.rail-brand-txt b .dot { color: var(--lime-700); }
.rail-brand-txt small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.rail-btn { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.rail-btn:hover { background: var(--soft); color: var(--ink); }
.rail-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.rail-btn svg { width: 18px; height: 18px; }
.rail-close, .rail-search-only { display: none; }

.rail-search { position: relative; margin: 2px 12px 8px; }
.rail-search input {
  width: 100%; height: 36px; padding: 0 52px 0 32px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--soft); border: 1px solid var(--line); border-radius: 9px; outline: none; -webkit-appearance: none; appearance: none;
}
.rail-search input::-webkit-search-cancel-button { display: none; }
.rail-search input::placeholder { color: var(--muted); }
.rail-search input:focus { background: var(--field-bg); border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-50); }
.rail-search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); display: inline-flex; pointer-events: none; }
.rail-search-ic svg { width: 15px; height: 15px; }
.rail-kbd, .tb-search kbd, .palette-in kbd {
  font-family: var(--font); font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; white-space: nowrap;
}
.rail-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }

.rail-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 10px 14px; }
.nav-top { display: flex; flex-direction: column; gap: 2px; }
.nav-sec { position: relative; margin-top: 14px; }
.nav-sec::before { content: ""; position: absolute; top: -8px; left: 10px; right: 8px; height: 1px; background: var(--line); }
.nav-sec-head {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 8px;
  border: 0; background: transparent; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink); cursor: pointer; text-align: left; letter-spacing: -.005em;
}
.nav-sec-head:hover { background: var(--soft); }
.nav-sec-head:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-sec-head .notch { width: 3.5px; height: 14px; border-radius: 99px; background: var(--lime); flex: 0 0 auto; }
.nav-sec-head .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sec-head .chev { display: inline-flex; color: var(--muted); transition: transform .15s; transform: rotate(-90deg); }
.nav-sec-head .chev svg { width: 14px; height: 14px; }
.nav-sec.open > .nav-sec-head .chev { transform: none; }
.nav-sec-body { display: none; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-sec.open > .nav-sec-body { display: flex; }

.nav-row { position: relative; display: flex; align-items: center; min-width: 0; }
.rail .nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 34px; padding: 5px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-decoration: none;
  font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.rail .nav-item:hover { background: var(--soft); }
.rail .nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
.rail .nav-item.active { background: var(--petrol-50); color: var(--ink); font-weight: 600; }
.rail .nav-item .ic { width: 18px; height: 18px; display: inline-flex; flex: 0 0 auto; color: var(--accent-ink); }
.rail .nav-item .ic svg { width: 18px; height: 18px; }
.rail .nav-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row > .nav-item { padding-right: 34px; }
.nav-row > .nav-item:last-child { padding-right: 10px; }
.nav-chev { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; padding: 0;
  border-radius: 7px; background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; }
button.nav-item > .nav-chev { position: static; transform: none; margin-left: auto; width: auto; height: auto; }
.nav-chev:hover { background: var(--line); color: var(--ink); }
.nav-chev:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-chev svg { width: 14px; height: 14px; transition: transform .15s; transform: rotate(-90deg); }
.nav-branch.open > .nav-row .nav-chev svg,
.nav-branch.open > button.nav-item .nav-chev svg { transform: none; }
.nav-children { display: none; flex-direction: column; gap: 1px; margin: 2px 0 4px 19px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-branch.open > .nav-children { display: flex; }
.rail .nav-item.sub { min-height: 30px; padding: 4px 8px; font-size: 12.8px; font-weight: 450; color: var(--muted); }
.rail .nav-item.sub:hover { color: var(--ink); }
.rail .nav-item.sub.active { color: var(--ink); font-weight: 600; }
.dot-mark { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); opacity: .5; flex: 0 0 auto; }
.nav-item.active .dot-mark { background: var(--accent-ink); opacity: 1; }
.nav-badge { margin-left: auto; flex: 0 0 auto; font-size: 10px; font-weight: 600; line-height: 1.5; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
.nav-badge.soon { border-style: dashed; text-transform: uppercase; letter-spacing: .05em; }
.rail .nav-item.is-soon { cursor: default; opacity: .62; }
.rail .nav-item.is-soon:hover { background: transparent; }
.rail .nav-item.is-soon .lbl { white-space: normal; line-height: 1.3; }
.nav-hint { margin-left: auto; flex: 0 1 auto; max-width: 45%; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }
@media (pointer: coarse) {
  .rail .nav-item, .rail .nav-item.sub, .nav-sec-head { min-height: 44px; }
  .rail-btn, .nav-chev { min-width: 44px; min-height: 44px; }
}

/* ---- Fuss: wer, Thema, Sprache, Abmelden ---- */
.rail-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.rail .user-mini { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 2px 8px; }
.rail .user-mini .av { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; background: var(--petrol-50); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.rail .user-mini .who { min-width: 0; flex: 1; }
.rail .user-mini .who b { display: block; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .user-mini .who .role-line { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .user-mini .who .role-line b { display: inline; font-size: 11.5px; color: var(--accent-ink); font-weight: 600; }
.rail-actions { display: flex; align-items: center; gap: 4px; }
.rail-actions .lang-pill { margin: 0 auto; }
.theme-toggle { color: var(--muted); }
.lang-pill { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 99px; background: var(--soft); }
.lang-pill button { border: 0; background: transparent; font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  padding: 3px 11px; border-radius: 99px; color: var(--muted); cursor: pointer; min-height: 26px; }
.lang-pill button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 68, 80, .12); }
.lang-pill button:focus-visible { outline: none; box-shadow: var(--ring); }
@media (pointer: coarse) { .lang-pill button { min-height: 40px; padding: 3px 14px; } }

/* ---- Kopfzeile: Brotkrumen + Suche ---- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar); display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 32px; background: var(--base); color: var(--ink);
}
@supports (backdrop-filter: blur(8px)) {
  .topbar { background: color-mix(in srgb, var(--base) 82%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}
.topbar .burger { display: none; background: transparent; border: 0; color: var(--ink); cursor: pointer; padding: 0; width: 44px; height: 44px;
  margin-left: -10px; place-items: center; border-radius: 10px; }
.topbar .burger svg { width: 22px; height: 22px; }
.topbar .tb-mark { display: none; font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--accent-ink); text-decoration: none; }
.topbar .tb-mark .dot { color: var(--lime-700); }
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .here { color: var(--ink); font-weight: 600; }
.crumb .sep { display: inline-flex; opacity: .6; flex: 0 0 auto; }
.crumb .sep svg { width: 13px; height: 13px; }
.tb-spacer { flex: 1; }
.tb-search { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); border-radius: 10px; font: inherit; font-size: 13px; cursor: pointer; flex: 0 0 auto; }
.tb-search:hover { border-color: var(--line-2); color: var(--ink); }
.tb-search:focus-visible { outline: none; box-shadow: var(--ring); }
.tb-search svg { width: 15px; height: 15px; }

/* ---- Seitenkopf + Inhalt: ruhig auf der Grundflaeche ---- */
.page-head { background: transparent; border-bottom: 0; padding: 6px 32px 20px; align-items: flex-end; }
.page-head h1 { font-size: 24px; font-weight: 650; letter-spacing: -.012em; margin: 0 0 4px; line-height: 1.25; }
.page-head p { font-size: 14px; line-height: 1.5; }
.content { padding: 0 32px 56px; }
.card { box-shadow: 0 1px 2px rgba(11, 68, 80, .04); }
.card.pad { padding: 22px; }
.card-head h3 { font-size: 15px; font-weight: 650; }
.section-title { font-size: 16px; font-weight: 650; letter-spacing: -.005em; }
.tabs { gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 0; margin-bottom: 20px; }
.empty { padding: 44px 20px; }
.empty .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--soft); }
.empty .ic svg { width: 22px; height: 22px; }
.empty h3 { font-size: 15.5px; font-weight: 650; }
.empty p { line-height: 1.55; }

/* ---- ⌘K Befehlspalette ---- */
.palette-back { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-dialog-back); }
.palette {
  position: fixed; top: 12vh; left: 50%; transform: translateX(-50%); width: min(620px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; z-index: var(--z-dialog);
  box-shadow: 0 24px 60px rgba(7, 23, 26, .28); overflow: hidden; display: flex; flex-direction: column; max-height: 76vh;
}
.palette-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-in svg { width: 18px; height: 18px; flex: 0 0 auto; }
.palette-in input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 16px; padding: 6px 0; }
.palette-list { overflow-y: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 14px; }
.pal-item .ic { display: inline-flex; color: var(--accent-ink); }
.pal-item .ic svg { width: 17px; height: 17px; }
.pal-item .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item.on, .pal-item:hover { background: var(--petrol-50); }
.palette-foot { padding: 8px 16px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---- eingeklappt: nur Symbole (nur am Schreibtisch) ---- */
@media (min-width: 861px) {
  body.rail-collapsed { --rail-w: 76px; }
  body.rail-collapsed .rail-head { flex-direction: column; padding: 12px 8px 6px; gap: 6px; }
  body.rail-collapsed .rail-brand { flex: 0 0 auto; padding: 2px; }
  body.rail-collapsed .rail-brand-txt,
  body.rail-collapsed .rail-search,
  body.rail-collapsed .nav-sec-head .lbl,
  body.rail-collapsed .nav-sec-head .chev,
  body.rail-collapsed .nav-sec-head .notch,
  body.rail-collapsed .rail .nav-item .lbl,
  body.rail-collapsed .nav-badge,
  body.rail-collapsed .nav-chev,
  body.rail-collapsed .nav-children,
  body.rail-collapsed .rail .user-mini .who,
  body.rail-collapsed .lang-pill { display: none; }
  body.rail-collapsed .rail-search-only { display: inline-grid; margin: 0 auto 6px; }
  body.rail-collapsed .rail-nav { padding: 2px 8px 12px; }
  body.rail-collapsed .nav-sec-head { min-height: 6px; padding: 0; pointer-events: none; }
  body.rail-collapsed .nav-sec-body { display: flex; }
  body.rail-collapsed .rail .nav-item { justify-content: center; padding: 6px; }
  body.rail-collapsed .nav-row > .nav-item { padding-right: 6px; }
  body.rail-collapsed .rail .nav-item.in-path { background: var(--petrol-50); }
  body.rail-collapsed .rail .user-mini { justify-content: center; padding: 2px 0 8px; }
  body.rail-collapsed .rail-actions { flex-direction: column; }
  body.rail-collapsed .rail-foot { padding: 10px 8px 12px; }
}

/* ---- Handy + Tablet: Leiste als Schublade ---- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; height: 100vh; height: 100dvh; margin: 0; width: min(86vw, 320px);
    border-radius: 0 16px 16px 0; border-left: 0; z-index: var(--z-nav);
    transform: translateX(-105%); transition: transform .22s ease, visibility .22s; box-shadow: none; visibility: hidden;
    padding-top: env(safe-area-inset-top);
  }
  .rail.open { transform: none; visibility: visible; box-shadow: 0 24px 60px rgba(7, 23, 26, .3); }
  .rail-collapse, .rail-kbd { display: none; }
  .rail-search input { padding-right: 12px; }
  .rail-close { display: inline-grid; }
  .tb-search svg { width: 19px; height: 19px; }
  .topbar { padding: 6px 16px; min-height: 56px; }
  .topbar .burger { display: inline-grid; }
  .topbar .tb-mark { display: inline-block; }
  .crumb { display: none; }
  .tb-search { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .tb-search span, .tb-search kbd { display: none; }
  .page-head { padding: 8px 16px 16px; }
  .content { padding: 0 16px 40px; }
  .page-head h1 { font-size: 21px; }
  body.nav-open { overflow: hidden; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .topbar, .page-head { padding-left: 24px; padding-right: 24px; }
  .content { padding-left: 24px; padding-right: 24px; }
}

/* ---- bare: Vollbild ohne Schale (z. B. #/start) ---- */
body.is-bare .rail, body.is-bare .topbar, body.is-bare .backdrop { display: none; }
body.is-bare .shell { display: block; }

@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* ============================================================
   EIGENEN KI-AGENTEN VERBINDEN (MCP) — views/agent.js (2026-11-13)
   Additive block: connection page + OAuth consent screen.
   ============================================================ */
.ag-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.ag-steps li { display: flex; gap: 12px; align-items: flex-start; background: var(--soft); border-radius: 10px; padding: 14px; min-width: 0; }
.ag-step-ic { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; background: var(--petrol); color: #fff; display: grid; place-items: center; }
.ag-step-ic svg { width: 18px; height: 18px; }
.ag-step-tx { display: grid; gap: 3px; min-width: 0; font-size: 13.5px; }
.ag-step-tx span { color: var(--muted); }
.ag-safe { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ag-safe li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.ag-safe svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; color: var(--accent-ink); }
.ag-code { display: flex; align-items: center; gap: 8px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; margin: 8px 0 4px; min-width: 0; }
.ag-code code { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; color: var(--ink); }
.ag-code .ag-copy { flex: 0 0 auto; }
.ag-tabs { margin-bottom: 12px; }
.ag-client { min-width: 0; }
.ag-howto { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 10px; font-size: 14px; }
.ag-howto li { min-width: 0; }
.ag-howto code, .ag-c-who code, .tbl code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.ag-keyform { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.notice .ag-code { margin-top: 10px; }
.auth-card.ag-consent { max-width: 520px; }
.ag-c-title { font-size: 19px; line-height: 1.35; margin: 0 0 16px; font-weight: 700; overflow-wrap: anywhere; }
.ag-c-who { margin: 0 0 16px; display: grid; gap: 8px; background: var(--soft); border-radius: 10px; padding: 12px 14px; }
.ag-c-who div { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 13.5px; }
.ag-c-who dt { color: var(--muted); }
.ag-c-who dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.ag-c-rights { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.ag-c-rights li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; }
.ag-c-rights li > span:last-child { display: grid; gap: 2px; min-width: 0; }
.ag-c-rights li > span:last-child > span { color: var(--muted); }
.ag-c-ic { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; background: var(--petrol-50); color: var(--accent-ink); display: grid; place-items: center; }
.ag-c-ic svg { width: 16px; height: 16px; }
.ag-c-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.ag-c-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.ag-c-actions .btn { flex: 1 1 140px; }
.auth-ok .ok-ic.ag-warn { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 480px) {
  .ag-c-who div { grid-template-columns: 1fr; gap: 2px; }
}
.ag-sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
/* "Verbinden" success state (CEO 2026-11-21): one line per connected program, guide folded */
.ag-conns { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.ag-conn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--success-soft); border: 1px solid var(--notice-ok-line, var(--line)); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.ag-conn-ic { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: var(--card); color: var(--success); border: 1px solid var(--notice-ok-line, var(--line)); display: grid; place-items: center; }
.ag-conn-ic svg { width: 15px; height: 15px; }
.ag-conn-tx { flex: 1 1 200px; min-width: 0; display: grid; gap: 2px; font-size: 14px; overflow-wrap: anywhere; }
.ag-conn-tx span { color: var(--muted); font-size: 12.5px; }
.ag-conn .btn { flex: 0 0 auto; }
.ag-more { display: flex; gap: 8px; flex-wrap: wrap; }
.ag-more .btn { height: auto; min-height: 36px; white-space: normal; line-height: 1.3; padding-top: 8px; padding-bottom: 8px; text-align: left; }

/* ---- KI-Credits (REA P3, 2026-11-13): Stand im Navigationsfuss + Seite Skalierung → Credits ---- */
.credit-mini { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin: 0 0 8px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--card); text-decoration: none; font-size: 13px; }
.credit-mini[hidden] { display: none; }
.credit-mini b { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.credit-mini:hover, .credit-mini:focus-visible { border-color: var(--accent-ink); }
.credit-mini.low b { color: var(--danger); }
.credit-mini-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 861px) {
  body.rail-collapsed .credit-mini { justify-content: center; padding: 6px 4px; }
  body.rail-collapsed .credit-mini-label { display: none; }
}
.credit-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@media (min-width: 900px) { .credit-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.credit-grid > .card { margin: 0; min-width: 0; }
.credit-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 4px 0 12px; }
.credit-hero-num { font-size: clamp(32px, 7vw, 44px); font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.credit-hero.low .credit-hero-num { color: var(--danger); }
.credit-hero-unit { font-weight: 600; color: var(--ink); }
.credit-hero-eur { color: var(--muted); font-size: 14px; flex-basis: 100%; }
.credit-facts { margin: 12px 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink); font-size: 14px; }
.credit-facts a { margin-left: 4px; }
.credit-packs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.credit-pack { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.credit-pack-num { font-weight: 700; color: var(--ink); min-width: 0; flex: 1 1 140px; }
.credit-pack-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.credit-pack small { font-weight: 400; color: var(--muted); }
.credit-pack .btn { margin-left: auto; min-height: 40px; }
.credit-pack .btn[disabled] { opacity: .7; cursor: not-allowed; }
.credit-neg { color: var(--danger); font-variant-numeric: tabular-nums; }
.credit-pos { color: var(--success); font-variant-numeric: tabular-nums; }
.credit-pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---- Paket vor dem Live-Gang (views/paywall.js, CEO 2026-11-13) ----
   Tokens only, so light and dark follow the theme. Nothing here is wider than
   its container: the modal is min(460px, 100vw - 32px) and everything wraps. */
.pw-dialog { width: min(520px, calc(100vw - 32px)); }
.pw-lead { display: flex; gap: 8px; align-items: flex-start; }
.pw-lead svg, .pw-hint svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; color: var(--petrol); }
.pw-plans { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; display: grid; gap: 8px; }
.pw-legend { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; padding: 0; }
.pw-plan {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--field-bg); cursor: pointer;
}
.pw-plan.on { border-color: var(--petrol); box-shadow: 0 0 0 1px var(--petrol); }
.pw-plan.off { opacity: .55; cursor: not-allowed; }
.pw-plan input { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--petrol); }
.pw-plan-tx, .pw-plan-px { display: flex; flex-direction: column; min-width: 0; }
.pw-plan-tx { flex: 1 1 auto; }
.pw-plan-tx b, .pw-plan-px b { color: var(--ink); font-size: 15px; }
.pw-plan-tx span, .pw-plan-px span { color: var(--muted); font-size: 12px; }
.pw-plan-px { text-align: right; flex: 0 0 auto; }
.dialog-body .pw-note, .dialog-body .pw-muted { font-size: 13px; }
.pw-terms { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink); margin: 4px 0 8px; }
.pw-terms input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--petrol); }
.dialog-body .pw-err { color: var(--danger); font-size: 13px; margin: 6px 0 0; }
.pw-done { display: flex; gap: 12px; align-items: flex-start; }
.pw-done b { color: var(--ink); }
.pw-done p { margin: 6px 0 0; }
.pw-done-ic { flex: 0 0 auto; display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; background: var(--success-soft); color: var(--success); }
.pw-done-ic svg { width: 18px; height: 18px; }
.pw-hint { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.pw-card p { color: var(--muted); margin: 8px 0 0; }
.pw-card-head { display: flex; align-items: center; gap: 8px; }
.pw-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.pw-badge.free { background: var(--soft); color: var(--accent-ink); border: 1px solid var(--line); }
.pw-badge.paid { background: var(--success-soft); color: var(--success); }
.pw-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.pw-cols h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: none; }
.pw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pw-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink); }
.pw-list svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; }
.pw-list.ok svg { color: var(--success); }
.pw-list.lock svg { color: var(--muted); }
.pw-plan-tx .pw-plan-short { color: var(--ink); font-size: 13px; }
/* Tarif tab: the three packages with what each takes over (CEO 2026-11-17). */
.pw-pkgs-wrap { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.pw-pkgs-title { margin: 0; font-size: 15px; color: var(--ink); }
.pw-card .pw-pkgs-lead { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.pw-pkgs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.pw-pkg {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--field-bg);
}
.pw-pkg.hl { border-color: var(--petrol); box-shadow: 0 0 0 1px var(--petrol); }
.pw-pkg.cur { border-color: var(--success); box-shadow: 0 0 0 1px var(--success); }
.pw-pkg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pw-pkg-head h4 { margin: 0; font-size: 15px; color: var(--ink); text-transform: none; }
.pw-pkg-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--petrol); color: #fff; }
.pw-pkg-tag.cur { background: var(--success-soft); color: var(--success); }
.pw-pkg-tag svg { width: 14px; height: 14px; }
.pw-pkg-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pw-pkg-price b { font-size: 24px; color: var(--ink); line-height: 1.2; }
.pw-pkg-price span, .pw-pkg-seats { font-size: 13px; color: var(--muted); }
.pw-pkg-first { font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.pw-card .pw-pkg-intro { margin: 6px 0 4px; font-size: 14px; color: var(--muted); }
.pw-pkg .pw-list { margin-bottom: 8px; }
.pw-pkg .pw-list li { overflow-wrap: anywhere; }
.pw-pkg-go { margin-top: auto; width: 100%; min-height: 44px; justify-content: center; }
@media (max-width: 1024px) { .pw-pkgs { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 420px) {
  .pw-plan { gap: 10px; padding: 10px; }
  .pw-dialog .dialog-actions .btn { flex: 1 1 100%; }
}

/* "Sofort DOI" card on Heute (views/mail_consent.js, CEO 2026-11-13) — quiet, dismissable. */
.doi-card { position: relative; margin-bottom: 16px; padding-right: 48px; }
.doi-card h3 { margin: 0 0 6px; font-size: 15px; }
.doi-card .hint { overflow-wrap: anywhere; }
.doi-card .form-actions { justify-content: flex-start; flex-wrap: wrap; }
.doi-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; opacity: .7; }
.doi-x:hover { opacity: 1; }
.doi-x svg { width: 16px; height: 16px; }

/* Contact import with preview + column mapping (2026-11-18) */
.imp-needs { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; }
.imp-needs ul { margin: 6px 0 4px 18px; padding: 0; display: grid; gap: 2px; }
.imp-preview { margin-top: 14px; display: grid; gap: 10px; min-width: 0; }
.imp-table { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
.imp-table table { min-width: 100%; border-collapse: collapse; font-size: 13px; }
.imp-table th, .imp-table td { padding: 6px 10px; text-align: left; vertical-align: top; white-space: nowrap; border-bottom: 1px solid var(--line); }
.imp-table th { background: var(--soft); }
.imp-h { font-weight: 600; margin-bottom: 4px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.imp-map { font: inherit; font-size: 12.5px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--card, transparent); color: var(--ink); max-width: 200px; }
.imp-bad { font-size: 13px; }
.imp-bad ul { margin: 6px 0 0 18px; padding: 0; display: grid; gap: 2px; }

/* Lead-Finder bulk selection (2026-11-18) */
.fr-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 12px; margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.fr-bulk.running { font-size: 14px; }
.fr-bulk .btn { margin-left: auto; }
.fr-bulk-done { margin: 4px 0 10px; }
.fr-bulk-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fr-pick { display: inline-flex; align-items: center; margin-right: 8px; cursor: pointer; }
.fr-pick input { width: 18px; height: 18px; accent-color: var(--petrol, #0E5561); }
.fr-card.is-sel { outline: 2px solid var(--petrol, #0E5561); outline-offset: -2px; }

/* Lead-Finder filter row (CEO 2026-11-18: "Kachel ist zu nah am Sortierung-Button"):
   room below the row before the result cards, and the two checkboxes sit on the
   same line as the sort select instead of hanging above its baseline. */
.fr-filters { gap: 10px 20px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.fr-filters > .chk { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; }
.fr-filters > .muted { min-height: 40px; display: inline-flex; align-items: center; }
