/* Layout and components. Colours, radii, spacing and fonts come only from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--ink); text-decoration-color: var(--muted); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: -0.012em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Icons: Lucide outline SVGs used as masks so they take the text colour */
.icon {
  display: inline-block; flex: none;
  width: var(--icon-size); height: var(--icon-size);
  background-color: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

/* Shell */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); height: 100vh; }

.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--sp-3) 0; gap: var(--sp-1); position: relative; z-index: 60;
}
.rail-spacer { flex: 1; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 40px; margin-bottom: var(--sp-2); color: var(--ink); }
.brand-mark svg { width: 44px; height: auto; display: block; }
.np-line { fill: var(--line); }
.np-word { fill: var(--ink); font-family: "Spectral", Georgia, serif; }
.np-sub { fill: var(--brand-sand); font-family: var(--font-brand); }
.login-logo { display: block; width: 190px; height: auto; color: var(--ink); margin-bottom: var(--sp-4); }
.rail-btn {
  position: relative; width: 40px; height: 40px; border-radius: var(--r-card);
  display: grid; place-items: center; color: var(--icon);
}
.rail-btn:hover { background: var(--hover); color: var(--ink); }
.rail-btn.active { color: var(--ink); background: var(--hover); }
.rail-btn .icon { --icon-size: 18px; }
.rail-btn[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 48px; top: 50%; transform: translateY(-50%);
  background: var(--ink); color: var(--surface); font-size: var(--fs-small);
  padding: 3px 8px; border-radius: 4px; white-space: nowrap; z-index: 80; font-weight: 500;
  pointer-events: none;
}
.avatar {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 500; font-size: 13px;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; image-rendering: auto; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--surface); box-sizing: content-box; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.green { background: var(--presence-green); }
.dot.orange { background: var(--presence-orange); }
.dot.red { background: var(--presence-red); }

.main { display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr); min-width: 0; height: 100vh; position: relative; overflow: hidden; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-4); min-width: 0; }
.tabs { display: flex; gap: var(--sp-1); }
.tab {
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-input); color: var(--muted);
  font-family: var(--font-head); font-weight: 500; font-size: 14px;
}
.tab:hover { color: var(--ink); background: var(--hover); }
.tab.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.tab .n { color: var(--muted); font-family: var(--font-body); font-size: var(--fs-small); margin-left: 4px; }

.field {
  height: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 0 var(--sp-3);
}
select.field { padding-right: var(--sp-2); }
.pool { max-width: 200px; }
.search { position: relative; flex: 1; max-width: 460px; min-width: 140px; }
.search input { width: 100%; padding-left: 34px; padding-right: 34px; }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search .icon { position: absolute; left: 11px; top: 9px; color: var(--icon); }
.search .kbd {
  position: absolute; right: 8px; top: 7px; font-size: var(--fs-pill); color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; background: var(--bg);
}
.who { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-input); }
.who:hover { background: var(--hover); }
.who .label { color: var(--muted); font-size: var(--fs-small); }

.dropdown {
  position: absolute; left: 0; right: 0; top: 40px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-menu); overflow: hidden;
}
.dd-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-2) var(--sp-3); text-align: left; }
.dd-item.sel, .dd-item:hover { background: var(--hover); }
.dd-item .clinic { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dd-empty { padding: var(--sp-3); color: var(--muted); }

/* Content: list and panel */
.content { display: grid; grid-template-columns: minmax(360px, 42%) minmax(0, 1fr); gap: var(--sp-3); padding: 0 var(--sp-3) var(--sp-3); min-height: 0; }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.list-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) var(--sp-2); flex-wrap: wrap; position: relative; }
.count { color: var(--muted); font-size: var(--fs-small); margin-right: auto; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-input); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--icon); background: var(--surface);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.active { color: var(--ink); background: var(--bg); }
.chips { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--tag-gray); border-radius: 4px;
  padding: 2px 6px 2px 10px; font-size: var(--fs-pill);
}
.chip .icon { --icon-size: 12px; width: 12px; height: 12px; }
.popover {
  position: absolute; right: var(--sp-3); top: 52px; z-index: 30; width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-menu); padding: var(--sp-3); display: grid; gap: var(--sp-2);
}
.popover label { display: grid; gap: 2px; font-size: var(--fs-small); color: var(--muted); }
.popover select { color: var(--ink); }

.list { background: #F7F6F3; overflow: auto; padding: var(--sp-1) var(--sp-3) var(--sp-3); display: grid; gap: var(--sp-2); align-content: start; flex: 1; }
.card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42%); gap: var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface);
  padding: var(--sp-3); cursor: pointer; text-align: left;
}
.card { border-color: transparent; box-shadow: var(--shadow-rest); transition: box-shadow 0.12s ease; }
.card:hover { box-shadow: var(--shadow-lift); }
.card.selected, .card.selected:hover { box-shadow: 0 0 0 2px var(--select-ring), var(--shadow-rest); }
/* A lead that became a client shows its Kundennummer as a green tag */
.card-id.kn, .panel-id.kn { background: var(--tag-green); color: var(--tag-ink); border-radius: 4px; padding: 0 6px; font-weight: 500; }
.card-id {color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--fs-small); }
.card-name {
  font-family: var(--font-head); font-weight: 600; font-size: 16px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0 var(--sp-2);
}
.card-meta { display: flex; flex-wrap: wrap; gap: 2px var(--sp-3); font-size: var(--fs-small); }
.card-meta > * { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-next { margin-top: var(--sp-2); color: var(--muted); font-size: var(--fs-small); }
.card-next b { font-weight: 600; }
.empty { padding: var(--sp-6) var(--sp-4); color: var(--muted); text-align: center; }

.notes {
  width: 100%; resize: none; background: var(--notes); border: 1px solid var(--notes-line);
  border-radius: var(--r-input); padding: var(--sp-2) var(--sp-3); line-height: 1.4; display: block;
}
.notes::placeholder { color: var(--muted); }
.notes.card-notes { height: calc(3 * 1.4em + 10px); padding-bottom: 0; font-size: var(--fs-small); overflow: auto; }
.notes.card-notes.lifted {
  position: fixed; z-index: 70; resize: none; padding: var(--sp-3); font-size: var(--fs-base);
  background: var(--notes); border-color: var(--notes-line); border-radius: 16px; box-shadow: var(--shadow-menu);
  animation: notes-lift 0.16s ease-out;
}
.notes.card-notes.lifted:focus-visible { outline: none; }
.notes-close {
  position: fixed; z-index: 71; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; color: var(--icon); animation: notes-lift 0.16s ease-out;
}
.notes-close:hover { background: var(--hover); color: var(--ink); }
.notes-date {
  position: fixed; z-index: 71; height: 28px; padding: 0 10px; border-radius: 8px; gap: 6px;
  display: inline-flex; align-items: center; font-size: var(--fs-small); color: var(--muted);
  animation: notes-lift 0.16s ease-out;
}
.notes-date:hover { background: var(--hover); color: var(--ink); }
@keyframes notes-lift { from { opacity: 0.6; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.notes.panel-notes { min-height: 140px; height: 180px; resize: vertical; }

.pill {
  display: inline-block; background: var(--tag-gray); color: var(--tag-ink); font-size: var(--fs-pill);
  padding: 1px 8px; border-radius: 4px; line-height: 1.5; white-space: nowrap;
}

/* Panel */
.panel-scroll { overflow: auto; padding: var(--sp-4) var(--sp-5) var(--sp-5); display: grid; gap: var(--sp-4); align-content: start; }
.panel-head { display: grid; gap: var(--sp-2); justify-items: start; }
.panel-id { color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.clinic-title {
  font-family: var(--font-head); font-weight: 600; font-size: var(--fs-title); line-height: 1.25; text-align: left;
  text-decoration: underline transparent; text-underline-offset: 3px;
}
.clinic-title:hover { text-decoration-color: var(--ink); }
.box { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-3) var(--sp-4); }
.box-title { font-family: var(--font-head); font-weight: 500; font-size: 13px; color: var(--muted); margin-bottom: var(--sp-2); letter-spacing: 0.02em; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px var(--sp-3); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.na { color: var(--muted); font-style: italic; }
.saved { color: var(--muted); font-size: var(--fs-small); min-height: 1.4em; margin-top: 4px; }

.back-btn { display: none; }

/* Outcome bar */
.outcomes { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.outcomes { position: relative; }
/* Lead that is already a client: no outcomes, a pointer into the Kunden tab */
.client-lock { display: grid; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-card); background: var(--tag-green); }
.lock-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.lock-head .kn { background: #fff; }
.lock-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.client-lock .btn.ghost { background: #fff; }
.out-select { width: 100%; max-width: 340px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; text-align: left; }
.out-chev { width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); }
.out-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; width: 100%; max-width: 340px; margin: 0; padding: var(--sp-1);
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-input);
  box-shadow: 0 6px 20px rgba(18, 26, 42, 0.08);
}
.out-opt { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 7px var(--sp-3); border-radius: 6px; cursor: pointer; }
.out-opt:hover { background: var(--hover); }
.out-box { flex: none; width: 16px; height: 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); position: relative; }
.out-box.on::after { content: ""; position: absolute; left: 4.5px; top: 1px; width: 4px; height: 8px; border: solid var(--tick); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ob-dt-wrap { display: flex; align-items: center; gap: var(--sp-2); }
.out-opt-r { display: flex; align-items: center; gap: var(--sp-2); }
.out-del { color: var(--muted); font-size: 17px; line-height: 1; padding: 0 4px; opacity: 0; }
.out-opt:hover .out-del, .out-del:focus-visible { opacity: 0.7; }
.out-del:hover { opacity: 1; color: var(--ink); }
.out-new { color: var(--muted); margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; }
.out-add-row { list-style: none; padding: var(--sp-2) var(--sp-1) var(--sp-1); border-top: 1px solid var(--line); margin-top: 4px; }
.out-add { display: flex; gap: var(--sp-2); }
.out-add .field { flex: 1; min-width: 0; }
.ob-form { margin-top: var(--sp-3); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-2); align-items: center; }
.ob-form .field { width: 100%; }
.ob-form .err { grid-column: 1 / -1; color: var(--ink); font-weight: 500; font-size: var(--fs-small); }
.ob-form .hint { grid-column: 1 / -1; color: var(--muted); font-size: var(--fs-small); }
.btn {
  height: 34px; padding: 0 var(--sp-4); border-radius: var(--r-input); background: var(--ink); color: var(--surface);
  font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
}
.btn:hover { opacity: 0.88; }
.btn.save { background: var(--save); color: var(--ink); }
.btn.save:hover { background: var(--save-hover); opacity: 1; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); opacity: 1; }

.timeline { display: grid; gap: var(--sp-3); }
.tl-item { display: grid; gap: 2px; padding-left: var(--sp-3); border-left: 2px solid var(--line); }
.tl-top { display: flex; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-small); color: var(--muted); }
.tl-out { font-weight: 500; }
.tl-note { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Full card */
.overlay {
  position: absolute; z-index: 50; inset: 0; background: var(--dim);
  display: grid; place-items: center; padding: var(--sp-5);
}
.full {
  background: var(--surface); border-radius: var(--r-full); box-shadow: var(--shadow-card);
  width: min(1080px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
}
.full-head { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-5) var(--sp-5) var(--sp-3); border-bottom: 1px solid var(--line); }
.full-head .grow { flex: 1; min-width: 0; display: grid; gap: var(--sp-2); justify-items: start; }
.full-title { font-size: var(--fs-title-lg); line-height: 1.2; overflow-wrap: anywhere; }
.full-body { overflow: auto; padding: var(--sp-5); display: grid; gap: var(--sp-4); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.grid3 .wide { grid-column: 1 / -1; }
.full-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.link-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-input); text-decoration: none; background: var(--surface);
}
.link-btn:hover { background: var(--hover); }
.link-btn.disabled { color: var(--muted); pointer-events: none; }

/* Menus, toast, empty states */
/* Profile drawer */
.profile-dim { position: fixed; z-index: 85; inset: 0 0 0 var(--rail-w); background: var(--dim); }
.profile {
  position: fixed; z-index: 90; top: var(--sp-3); bottom: var(--sp-3); left: calc(var(--rail-w) + var(--sp-3));
  width: min(440px, calc(100vw - var(--rail-w) - 2 * var(--sp-3)));
  background: var(--surface); border-radius: var(--r-full); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; overflow: hidden; animation: profile-in 0.16s ease-out;
}
.profile.wide { width: min(820px, calc(100vw - var(--rail-w) - 2 * var(--sp-3))); }
.profile-tabs { display: flex; gap: var(--sp-1); padding: var(--sp-2) var(--sp-5) 0; border-bottom: 1px solid var(--line); }
.profile-tab { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-input) var(--r-input) 0 0; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.profile-tab:hover { color: var(--ink); }
.profile-tab.on { color: var(--ink); border-bottom-color: var(--ink); }
@keyframes profile-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.profile-head { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); border-bottom: 1px solid var(--line); }
.profile-head .grow { flex: 1; min-width: 0; }
.profile-name { font-size: var(--fs-title-lg); line-height: 1.2; overflow-wrap: anywhere; }
.avatar.big { width: 64px; height: 64px; flex: none; }
.avatar.big .dot.big-dot { width: 12px; height: 12px; right: 0; bottom: 0; }
.profile-body { overflow: auto; padding: var(--sp-4) var(--sp-5) var(--sp-5); display: grid; gap: var(--sp-5); align-content: start; flex: 1; }
.profile-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); display: flex; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r-input); display: grid; place-items: center; color: var(--icon); flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.status-list { display: grid; gap: var(--sp-1); }
.status-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 32px; gap: var(--sp-2); align-items: center; padding: 4px var(--sp-1); border-radius: var(--r-card); }
.status-row.on { background: var(--hover); }
.status-pick { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.status-row.on .status-pick .dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--ink); }
.status-label { width: 100%; background: transparent; border-color: transparent; }
.status-row:hover .status-label, .status-label:focus { background: var(--surface); border-color: var(--line); }
.swatches { display: inline-flex; gap: 2px; align-items: center; }
.swatch { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; opacity: 0.45; }
.swatch:hover, .swatch.on, .swatch:has(input:checked) { opacity: 1; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--focus); }
.status-add { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.profile-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.pf { display: grid; gap: 4px; color: var(--muted); font-size: var(--fs-small); }
.pf.wide { grid-column: 1 / -1; }
.pf .field { color: var(--ink); font-size: var(--fs-base); width: 100%; }
textarea.field.about { height: auto; min-height: 84px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.45; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: var(--surface); border-radius: var(--r-card); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-4); box-shadow: var(--shadow-menu);
}
.toast button { color: var(--surface); text-decoration: underline; font-weight: 500; }
.toast.plain { padding-right: var(--sp-4); }

.placeholder-view { grid-row: 2; display: grid; place-items: center; color: var(--icon); text-align: center; padding: var(--sp-5); }
.placeholder-view h2 { color: var(--ink); margin-bottom: var(--sp-2); font-size: 22px; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: var(--sp-4); }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full);
  padding: var(--sp-6); display: grid; gap: var(--sp-4);
}
.login-card h1 { font-size: 30px; }
.login-card form { display: grid; gap: var(--sp-3); }
.login-card label { display: grid; gap: 4px; color: var(--muted); font-size: var(--fs-small); }
.login-card .field { height: 40px; color: var(--ink); font-size: 15px; }
.login-card .btn { height: 42px; }
.login-card .err { color: var(--ink); font-weight: 500; min-height: 1.4em; }
.login-card .switch { color: var(--muted); font-size: var(--fs-small); text-align: center; text-decoration: underline; }

/* Responsive */
@media (max-width: 900px) {
  .content { grid-template-columns: minmax(0, 1fr); }
  .panel-col {
    position: absolute; z-index: 45; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
    border-radius: 0; border-width: 0 0 0 1px; transform: translateX(105%); transition: transform 0.18s ease;
  }
  .panel-col.open { transform: none; box-shadow: var(--shadow-card); }
  .back-btn { display: inline-flex; }
  .grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid3 .wide { grid-column: 1 / -1; }
  .who .label { display: none; }
}
@media (max-width: 760px) {
  .grid3, .grid3 .wide { grid-template-columns: minmax(0, 1fr); grid-column: auto; }
}
@media (max-width: 600px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 52px; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 0 var(--sp-2); border-right: 0; border-top: 1px solid var(--line); }
  .rail-spacer { display: none; }
  .rail-btn[data-tip]:hover::after { display: none; }
  .main { height: auto; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .content { grid-template-columns: minmax(0, 1fr); padding: 0 var(--sp-2) var(--sp-2); }
  .content > .col:first-child { min-width: 0; }
  .card { grid-template-columns: minmax(0, 1fr); }
  .notes.card-notes { height: calc(2 * 1.4em + 10px); }
  .kv { grid-template-columns: 112px minmax(0, 1fr); }
  .who { display: none; }
  .profile-dim { inset: 0 0 52px 0; }
  .profile { left: 0; right: 0; top: 0; bottom: 52px; width: auto; border-radius: 0; }
  .profile-fields { grid-template-columns: minmax(0, 1fr); }
  .status-row { grid-template-columns: 32px minmax(0, 1fr) 32px; }
  .status-row .swatches { grid-column: 2; grid-row: 2; }
  .status-add { grid-template-columns: minmax(0, 1fr); }
  .overlay { padding: var(--sp-2); }
  .full-head, .full-body { padding: var(--sp-4); }
  .ob-form { grid-template-columns: minmax(0, 1fr); }
  .panel-scroll { padding: var(--sp-3); }
  .pool { max-width: 140px; }
}

/* Klasse badge (tier A to D) and the date quick-picks of the outcome form */
.card-top { display: flex; align-items: center; gap: var(--sp-2); }
.tier {
  display: inline-block; font-size: var(--fs-pill); font-weight: 500; line-height: 1.5; padding: 0 8px; border-radius: 4px;
  border: 1px solid var(--tier-line); color: var(--ink); white-space: nowrap;
}
.tier-a { background: var(--tier-a); }
.tier-b { background: var(--tier-b); }
.tier-c { background: var(--tier-c); }
.tier-d { background: var(--tier-d); }
.quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.quick-l { color: var(--muted); font-size: var(--fs-small); margin-right: var(--sp-1); }
.chip-btn {
  height: 28px; padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: var(--fs-small); color: var(--ink);
}
.chip-btn:hover { background: var(--hover); }
.chip-btn.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
