/* Capynova CRM – ruhiges, Notion-ähnliches Erscheinungsbild. Keine externen Schriften. */

:root {
  --bg: #ffffff;
  --bg-side: #f7f7f5;
  --bg-soft: #fbfbfa;
  --text: #37352f;
  --text-2: rgba(55, 53, 47, 0.65);
  --text-3: rgba(55, 53, 47, 0.4);
  --border: #e9e9e7;
  --border-strong: #dfdfdd;
  --hover: rgba(55, 53, 47, 0.06);
  --active: rgba(55, 53, 47, 0.1);
  --accent: #2383e2;
  --accent-hover: #0077d4;
  --accent-soft: rgba(35, 131, 226, 0.12);
  --red: #e03e3e;
  --green: #0f7b6c;
  --focus: rgba(35, 131, 226, 0.55);
  --shadow-pop: rgba(15, 15, 15, 0.05) 0 0 0 1px, rgba(15, 15, 15, 0.1) 0 3px 6px, rgba(15, 15, 15, 0.2) 0 9px 24px;
  --shadow-card: rgba(15, 15, 15, 0.08) 0 0 0 1px, rgba(15, 15, 15, 0.08) 0 2px 4px;
  --radius: 6px;
  --side-w: 248px;

  --tag-default-bg: rgba(227, 226, 224, 0.5);
  --tag-default-fg: rgb(50, 48, 44);
  --tag-gray-bg: rgb(227, 226, 224);
  --tag-gray-fg: rgb(50, 48, 44);
  --tag-brown-bg: rgb(238, 224, 218);
  --tag-brown-fg: rgb(68, 42, 30);
  --tag-orange-bg: rgb(250, 222, 201);
  --tag-orange-fg: rgb(73, 41, 14);
  --tag-yellow-bg: rgb(253, 236, 200);
  --tag-yellow-fg: rgb(64, 44, 27);
  --tag-green-bg: rgb(219, 237, 219);
  --tag-green-fg: rgb(28, 56, 41);
  --tag-blue-bg: rgb(211, 229, 239);
  --tag-blue-fg: rgb(24, 51, 71);
  --tag-purple-bg: rgb(232, 222, 238);
  --tag-purple-fg: rgb(65, 36, 84);
  --tag-pink-bg: rgb(245, 224, 233);
  --tag-pink-fg: rgb(76, 35, 55);
  --tag-red-bg: rgb(255, 226, 221);
  --tag-red-fg: rgb(93, 23, 21);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --bg-side: #202020;
    --bg-soft: #1f1f1f;
    --text: rgba(255, 255, 255, 0.86);
    --text-2: rgba(255, 255, 255, 0.55);
    --text-3: rgba(255, 255, 255, 0.32);
    --border: #2f2f2f;
    --border-strong: #3a3a3a;
    --hover: rgba(255, 255, 255, 0.055);
    --active: rgba(255, 255, 255, 0.09);
    --accent-soft: rgba(35, 131, 226, 0.25);
    --red: #ff7369;
    --green: #4dab9a;
    --shadow-pop: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(0, 0, 0, 0.4) 0 3px 6px, rgba(0, 0, 0, 0.5) 0 9px 24px;
    --shadow-card: rgba(255, 255, 255, 0.07) 0 0 0 1px, rgba(0, 0, 0, 0.25) 0 2px 4px;

    --tag-default-bg: rgba(255, 255, 255, 0.09);
    --tag-default-fg: rgba(255, 255, 255, 0.85);
    --tag-gray-bg: rgb(71, 71, 71);
    --tag-gray-fg: rgba(255, 255, 255, 0.88);
    --tag-brown-bg: rgb(92, 59, 35);
    --tag-brown-fg: rgba(255, 255, 255, 0.88);
    --tag-orange-bg: rgb(136, 72, 15);
    --tag-orange-fg: rgba(255, 255, 255, 0.88);
    --tag-yellow-bg: rgb(146, 118, 63);
    --tag-yellow-fg: rgba(255, 255, 255, 0.88);
    --tag-green-bg: rgb(36, 73, 61);
    --tag-green-fg: rgba(255, 255, 255, 0.88);
    --tag-blue-bg: rgb(40, 69, 108);
    --tag-blue-fg: rgba(255, 255, 255, 0.88);
    --tag-purple-bg: rgb(73, 47, 100);
    --tag-purple-fg: rgba(255, 255, 255, 0.88);
    --tag-pink-bg: rgb(105, 49, 76);
    --tag-pink-fg: rgba(255, 255, 255, 0.88);
    --tag-red-bg: rgb(110, 54, 48);
    --tag-red-fg: rgba(255, 255, 255, 0.88);

    color-scheme: dark;
  }
}

/* ---------- Grundlagen ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-3);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: var(--text);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

p {
  margin: 6px 0;
}

kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-2);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-radius: 4px;
}

button {
  font: inherit;
  color: inherit;
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: 12px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.center {
  text-align: center;
}

.strong {
  font-weight: 600;
}

.text-red {
  color: var(--red) !important;
}

.spacer {
  flex: 1;
}

.grow {
  flex: 1;
  min-width: 0;
}

.wrap {
  flex-wrap: wrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Layout ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 10px;
  /* Kein overflow hier: sonst werden Menüs abgeschnitten. Stapelebene über dem Hauptbereich. */
  z-index: 40;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  min-width: 0;
  outline: none;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 40px 64px;
}

.page-wide {
  max-width: none;
}

.page-full {
  max-width: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.count-label {
  font-size: 14px;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.mobile-bar {
  display: none;
}

.nav-scrim {
  display: none;
}

/* ---------- Seitenleiste ---------- */

.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: var(--radius);
  min-width: 0;
}

.brand:hover {
  background: var(--hover);
}

.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-logo.big {
  width: 44px;
  height: 44px;
  font-size: 24px;
  border-radius: 10px;
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-2);
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  margin-bottom: 6px;
}

.sb-search span:nth-child(2) {
  flex: 1;
}

.sb-search:hover {
  background: var(--hover);
}

.sb-nav,
.sb-bottom {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sb-nav {
  min-height: 0;
  overflow-y: auto;
}

.sb-spacer {
  flex: 1;
  min-height: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  min-height: 32px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-2);
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--active);
  color: var(--text);
  font-weight: 600;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.nav-icon {
  width: 20px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-3);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: var(--text);
}

.nav-label {
  flex: 1;
}

.nav-kbd {
  margin-left: auto;
}

.nav-badge {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  padding: 0 6px;
  line-height: 18px;
  min-width: 18px;
  text-align: center;
}

.sb-views {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 4px 26px;
  max-height: 40vh;
  overflow-y: auto;
}

.nav-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  min-height: 28px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-sub.active {
  background: var(--active);
  color: var(--text);
  font-weight: 500;
}

.nav-sub-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub-meta {
  font-size: 11px;
  color: var(--text-3);
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 2px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.sb-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}

.sb-user-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-user-role {
  font-size: 12px;
  color: var(--text-2);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--tag-gray-bg);
  color: var(--tag-gray-fg);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 19px;
  background: var(--tag-blue-bg);
  color: var(--tag-blue-fg);
}

/* Glocke */

.bell {
  position: relative;
}

.bell-btn {
  position: relative;
}

.badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  text-align: center;
}

.popover {
  position: absolute;
  z-index: 80;
  background: var(--bg);
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
}

.bell-pop {
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.popover-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 8px 14px;
  border-bottom: 1px solid var(--border);
}

.popover-head strong {
  flex: 1;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
}

.notif-empty {
  padding: 16px;
}

.notif {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}

.notif:hover {
  background: var(--hover);
}

.notif.unread {
  background: var(--accent-soft);
}

.notif-title {
  font-weight: 500;
}

.notif-body {
  color: var(--text-2);
  font-size: 13px;
}

.notif-time {
  color: var(--text-3);
  font-size: 12px;
}

/* ---------- Schaltflächen & Eingaben ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background 0.1s ease;
}

.btn:hover {
  background: var(--hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-ghost.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-danger:hover {
  background: var(--red);
  filter: brightness(0.95);
}

.btn-danger-ghost {
  color: var(--red);
  border-color: transparent;
  background: transparent;
}

.btn-danger-ghost:hover {
  background: rgba(224, 62, 62, 0.08);
}

.btn-small {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.link-btn {
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-weight: 500;
}

.link-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.link-btn:disabled {
  cursor: default;
}

.input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  min-height: 34px;
  width: 100%;
  box-shadow: none;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.input:disabled {
  background: var(--bg-soft);
  color: var(--text-2);
}

textarea.input {
  resize: vertical;
  line-height: 1.5;
}

.input-small {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 13px;
  width: auto;
}

.input-amount {
  width: 110px;
}

.input-days {
  width: 76px;
}

.input.active {
  border-color: var(--accent);
}

select.input {
  cursor: pointer;
}

.search-input {
  max-width: 300px;
  min-width: 180px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  border: none;
  margin: 0;
  padding: 0;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-narrow {
  flex: 0 0 140px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

.form-error {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--red);
  background: rgba(224, 62, 62, 0.08);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 0;
  min-height: 28px;
}

.check-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check-item.disabled {
  opacity: 0.55;
}

.radio-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quick-add {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.quick-add .input:first-child {
  flex: 1;
  min-width: 140px;
}

.file-btn {
  cursor: pointer;
  position: relative;
}

.confirm-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.add-link {
  margin-top: 2px;
  align-self: flex-start;
}

/* ---------- Markierungen ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 21px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.tag-default {
  background: var(--tag-default-bg);
  color: var(--tag-default-fg);
}

.tag-gray {
  background: var(--tag-gray-bg);
  color: var(--tag-gray-fg);
}

.tag-brown {
  background: var(--tag-brown-bg);
  color: var(--tag-brown-fg);
}

.tag-orange {
  background: var(--tag-orange-bg);
  color: var(--tag-orange-fg);
}

.tag-yellow {
  background: var(--tag-yellow-bg);
  color: var(--tag-yellow-fg);
}

.tag-green {
  background: var(--tag-green-bg);
  color: var(--tag-green-fg);
}

.tag-blue {
  background: var(--tag-blue-bg);
  color: var(--tag-blue-fg);
}

.tag-purple {
  background: var(--tag-purple-bg);
  color: var(--tag-purple-fg);
}

.tag-pink {
  background: var(--tag-pink-bg);
  color: var(--tag-pink-fg);
}

.tag-red {
  background: var(--tag-red-bg);
  color: var(--tag-red-fg);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pill-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  max-width: 100%;
}

.pill-row.wrap {
  flex-wrap: wrap;
}

.pill-removable {
  padding-right: 2px;
}

.pill-x {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 3px;
  line-height: 18px;
}

.pill-x:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.pill-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.pill-check input {
  accent-color: var(--accent);
}

/* Auswahl mit unsichtbarer Liste über der Markierung (tastaturbedienbar). */
.pill-select,
.text-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 4px;
}

.pill-select select,
.text-select select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}

.pill-select:hover:not(.disabled),
.text-select:hover:not(.disabled) {
  background: var(--hover);
}

.pill-select:focus-within,
.text-select:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.text-select-value {
  padding: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-select-value.empty {
  color: var(--text-3);
}

/* ---------- Inline-Bearbeitung ---------- */

.inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
}

.inline-value {
  display: inline-block;
  min-width: 36px;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-value.multiline {
  white-space: pre-wrap;
}

.inline-value:hover:not(.readonly) {
  background: var(--hover);
}

.inline-value.readonly {
  cursor: default;
}

.inline-value.empty {
  color: var(--text-3);
}

.inline-value.overdue {
  color: var(--red);
  font-weight: 500;
}

.inline-input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  border-radius: 4px;
  padding: 1px 6px;
  min-width: 160px;
  width: 100%;
  outline: none;
}

.inline-area {
  min-height: 70px;
}

.inline-date {
  min-width: 140px;
}

.inline-clear {
  min-width: 20px;
  height: 20px;
  font-size: 10px;
  opacity: 0;
}

.inline:hover .inline-clear,
.inline-clear:focus {
  opacity: 1;
}

.title-inline .inline-value {
  font-size: 28px;
  font-weight: 700;
  padding: 0 6px;
  margin-left: -6px;
  white-space: normal;
}

.title-inline .inline-input {
  font-size: 24px;
  font-weight: 700;
}

/* ---------- Aufklappmenüs ---------- */

details.dropdown {
  position: relative;
  display: inline-block;
}

details.dropdown > summary {
  list-style: none;
}

details.dropdown > summary::-webkit-details-marker {
  display: none;
}

.dropdown-trigger {
  color: var(--text-2);
  font-weight: 500;
}

.dropdown-trigger.active {
  color: var(--accent);
  background: var(--accent-soft);
}

details[open] > .dropdown-trigger {
  background: var(--active);
}

.caret {
  font-size: 10px;
  opacity: 0.7;
}

.dropdown-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 4px);
  left: 0;
  min-width: 230px;
  max-width: 340px;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  background: var(--bg);
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  padding: 4px;
}

.dropdown-menu.align-right {
  left: auto;
  right: 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--hover);
}

.menu-form .menu-item {
  justify-content: center;
}

.menu-form .btn-primary.menu-item {
  color: #fff;
  background: var(--accent);
}

.menu-section {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-3);
}

.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

.menu-empty {
  padding: 8px 10px;
}

.menu-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

.check-list {
  display: flex;
  flex-direction: column;
  padding: 2px 6px;
}

.check-list-scroll {
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-inline .dropdown-trigger {
  min-height: 24px;
  padding: 0 6px;
  font-size: 13px;
}

/* ---------- Werkzeugleisten ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.segmented.wrap {
  flex-wrap: wrap;
}

.seg {
  border: none;
  background: transparent;
  padding: 4px 12px;
  min-height: 30px;
  cursor: pointer;
  color: var(--text-2);
  border-right: 1px solid var(--border);
}

.seg:last-child {
  border-right: none;
}

.seg:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.seg.active {
  background: var(--active);
  color: var(--text);
  font-weight: 600;
}

.seg:disabled {
  cursor: default;
}

a.seg {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Segment-Reiter oberhalb der Kontaktliste */
.seg-bar {
  margin-bottom: 12px;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.chip,
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  border-radius: 14px;
  padding: 2px 10px;
  min-height: 28px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

span.stat-chip {
  cursor: default;
}

.chip:hover,
.stat-chip:hover {
  background: var(--hover);
}

.chip.active,
.stat-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.stat-chip strong {
  color: var(--text);
}

.stat-red {
  color: var(--red);
  border-color: var(--red);
}

.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid rgba(35, 131, 226, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 10px;
  backdrop-filter: blur(6px);
}

.bulk-bar strong {
  margin-right: 6px;
}

/* ---------- Tabellen ---------- */

.table-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--border);
  transition: opacity 0.15s;
}

.loading-dim {
  opacity: 0.6;
}

.ctable {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 14px;
}

.ctable th,
.ctable td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
  height: 36px;
  max-width: 320px;
}

.ctable th:last-child,
.ctable td:last-child {
  border-right: none;
}

.ctable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  font-weight: 500;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.th-sort {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 500;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.th-sort:hover {
  background: var(--hover);
  color: var(--text);
}

.th-label {
  padding: 2px 4px;
}

.sort-arrow {
  color: var(--accent);
}

.col-check {
  width: 36px;
  text-align: center !important;
}

.col-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

.crow {
  outline: none;
}

.crow:hover td {
  background: var(--bg-soft);
}

.crow.focused td {
  background: var(--hover);
}

.crow.focused td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.crow.selected td {
  background: var(--accent-soft);
}

.crow.archived td {
  color: var(--text-2);
}

.crow:focus-visible td {
  background: var(--hover);
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
}

.row-link {
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-link:hover {
  text-decoration: underline;
}

.edit-btn {
  opacity: 0;
  min-width: 22px;
  height: 22px;
  font-size: 12px;
}

.crow:hover .edit-btn,
.edit-btn:focus-visible {
  opacity: 1;
}

.cell-text {
  display: inline-block;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.cell-date {
  white-space: nowrap;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  flex-wrap: wrap;
}

.pager-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mini-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.mini-table th,
.mini-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.mini-table thead th {
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}

.mini-table tbody th {
  font-weight: 500;
}

.mini-table tr.ignored td {
  color: var(--text-3);
}

.mini-table tr.inactive td {
  opacity: 0.6;
}

.mini-table td.chosen {
  background: var(--accent-soft);
  font-weight: 500;
}

.change-table {
  margin-top: 6px;
}

.samples {
  max-width: 340px;
}

/* ---------- Karten & Abschnitte ---------- */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.section-head .section-title {
  margin-bottom: 0;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.subsection-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-3);
  margin: 14px 0 6px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.row-actions {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.banner {
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 8px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
}

.banner-gray {
  background: var(--tag-default-bg);
}

.banner-yellow {
  background: var(--tag-yellow-bg);
  color: var(--tag-yellow-fg);
}

.banner-red {
  background: var(--tag-red-bg);
  color: var(--tag-red-fg);
}

.banner-green {
  background: var(--tag-green-bg);
  color: var(--tag-green-fg);
  flex-direction: column;
}

.setup-hint {
  white-space: pre-wrap;
}

.kv {
  display: grid;
  grid-template-columns: minmax(110px, max-content) 1fr;
  gap: 4px 14px;
  margin: 8px 0;
  font-size: 13px;
}

.kv dt {
  color: var(--text-2);
}

.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.kv-answers dd {
  white-space: pre-wrap;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.item:last-child {
  border-bottom: none;
}

.item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.item-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  margin-top: 2px;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ---------- Zustände ---------- */

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  padding: 24px 4px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.small-spinner {
  width: 13px;
  height: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-2);
}


.empty-title {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.empty-hint {
  font-size: 13px;
  margin-top: 4px;
}

.error-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--tag-red-bg);
  color: var(--tag-red-fg);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 10px 0;
}

/* ---------- Dialoge ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
  animation: fade 0.12s ease;
}

.modal {
  width: 100%;
  max-width: 580px;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  max-height: 84vh;
}

.modal-wide {
  max-width: 860px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 6px 20px;
}

.modal-head h2 {
  font-size: 17px;
}

.modal-body {
  padding: 8px 20px 20px;
  overflow-y: auto;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.shortcut-table {
  border-collapse: collapse;
  width: 100%;
}

.shortcut-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.shortcut-table td:first-child {
  width: 150px;
}

/* Befehlspalette */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 15, 15, 0.45);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  animation: fade 0.1s ease;
}

.palette {
  width: 100%;
  max-width: 640px;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.palette-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--text);
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}

.palette-item.active {
  background: var(--hover);
}


.palette-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-item-sub {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}

.palette-empty {
  padding: 16px;
  color: var(--text-2);
}

.palette-foot {
  border-top: 1px solid var(--border);
  padding: 6px 16px;
}

/* Meldungen */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  padding: 10px 8px 10px 14px;
  box-shadow: var(--shadow-pop);
  animation: fade 0.15s ease;
}


.toast-error {
  background: var(--red);
  color: #fff;
}

.toast-text {
  flex: 1;
}

.toast-link {
  color: inherit;
  font-weight: 600;
}

.toast .icon-btn {
  color: inherit;
  opacity: 0.8;
}

/* Info-Hinweis */

.info-tip {
  position: relative;
  display: inline-flex;
  color: var(--text-3);
  cursor: help;
  border-radius: 50%;
}

.info-tip:hover,
.info-tip:focus {
  color: var(--text);
}

.info-pop {
  display: none;
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  right: -8px;
  width: 300px;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 400;
  white-space: normal;
  text-align: left;
}

.info-tip:hover .info-pop,
.info-tip:focus .info-pop,
.info-tip:focus-within .info-pop {
  display: block;
}

/* Kontaktauswahl */

.picker {
  position: relative;
}

.picker-selected {
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-results {
  position: absolute;
  z-index: 60;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--bg);
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  max-height: 260px;
  overflow-y: auto;
}

.picker-item {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.picker-item.active,
.picker-item:hover {
  background: var(--hover);
}

.picker-hint {
  padding: 4px 2px;
}

/* ---------- Anmeldung ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg-side);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.login-brand h1 {
  font-size: 22px;
}

/* ---------- Kontaktseite ---------- */

.back-link {
  display: inline-block;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 14px;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 4px;
}

.back-link:hover {
  background: var(--hover);
  color: var(--text);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-title {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
  flex: 1 1 360px;
}

.detail-title-text {
  min-width: 0;
  flex: 1;
}

.title-inline {
  display: flex;
}

.detail-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 24px;
  align-items: start;
  margin-top: 12px;
}

.detail-main,
.detail-side {
  min-width: 0;
}

.props {
  padding: 8px 10px;
}

.prop-row {
  display: flex;
  align-items: flex-start;
  min-height: 34px;
  gap: 4px;
}

.prop-label {
  flex: 0 0 170px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  padding: 6px 6px;
  font-size: 14px;
}


.prop-value {
  flex: 1;
  min-width: 0;
  padding: 5px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.prop-add {
  margin: 4px 0 4px 6px;
}

.email-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.email-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 26px;
}

.email-addr {
  font-weight: 500;
}

.email-item .row-actions {
  opacity: 0;
}

.email-item:hover .row-actions,
.email-item:focus-within .row-actions {
  opacity: 1;
}

/* Notizen */

.note-composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.note-input {
  min-height: 76px;
}

.note-composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg);
}

.note.pinned {
  border-color: var(--tag-yellow-bg);
  background: color-mix(in srgb, var(--tag-yellow-bg) 25%, var(--bg));
}

.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.note-head .row-actions {
  opacity: 0;
}

.note:hover .note-head .row-actions,
.note-head .row-actions:focus-within {
  opacity: 1;
}

.note-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Kauf & Abo */

.billing-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Lead-Herkunft */

.lead {
  border-top: 1px solid var(--border);
  padding: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lead-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lead-more summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
}

.attendance {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.attendance .seg {
  min-height: 26px;
  font-size: 13px;
  padding: 2px 10px;
}

.consent-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.consent-list li {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}

.consent-list li .muted.small:last-child {
  flex-basis: 100%;
}

/* Verlauf */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.tl-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

/* Markierung auf der Zeitleiste; die Art steht als Text daneben. */
.tl-icon {
  width: 27px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding-top: 6px;
  z-index: 1;
}

.tl-icon::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-3);
}

.tl-body {
  min-width: 0;
  flex: 1;
}

.tl-head {
  display: flex;
  flex-direction: column;
}

.tl-title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.tl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 2px;
}

.tl-summary {
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}

.tl-snippet {
  color: var(--text-2);
  border-left: 2px solid var(--border-strong);
  padding-left: 8px;
}

.tl-foot {
  margin-top: 2px;
}

.tl-email-in .tl-icon::before,
.tl-email-out .tl-icon::before {
  border-color: var(--accent);
}

.tl-payment-failed .tl-icon::before,
.tl-refund .tl-icon::before,
.tl-cancellation-request .tl-icon::before {
  border-color: var(--red);
}

.tl-purchase .tl-icon::before,
.tl-subscription .tl-icon::before {
  border-color: var(--green);
}

/* Aufgaben (kompakt auf der Kontaktseite) */

.task-mini-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 28px;
}

.task-mini input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.task-mini.done .task-mini-title {
  text-decoration: line-through;
  color: var(--text-2);
}

.task-mini-title {
  flex: 1;
  min-width: 0;
}

.doc-item .link-btn {
  overflow-wrap: anywhere;
}

.audit summary {
  cursor: pointer;
  margin-bottom: 0;
}

.audit[open] summary {
  margin-bottom: 10px;
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.audit-changes {
  list-style: none;
  padding: 0 0 0 12px;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.audit-old {
  text-decoration: line-through;
  color: var(--text-2);
}

/* ---------- Pipeline ---------- */

.board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 24px;
  min-height: 60vh;
  -webkit-overflow-scrolling: touch;
}

.column {
  flex: 0 0 280px;
  background: var(--bg-side);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 170px);
}

.column-head {
  padding: 2px 4px 4px;
}

.column-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.column-prob {
  margin-left: auto;
}

.column-sums {
  color: var(--text-2);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.column-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
  overflow-y: auto;
  padding: 4px 2px;
  border-radius: 8px;
  transition: background 0.1s;
}

.column-body.drag-over {
  background: var(--accent-soft);
}

.column-empty {
  text-align: center;
  padding: 10px;
}

.column-add {
  justify-content: flex-start;
}

.deal-card {
  position: relative;
  background: var(--bg);
  border-radius: 7px;
  box-shadow: var(--shadow-card);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: grab;
  outline: none;
}

.deal-card:hover {
  background: var(--bg-soft);
}

.deal-card:focus-visible {
  box-shadow: 0 0 0 2px var(--focus);
}

.deal-card.dragging {
  opacity: 0.4;
}

.deal-card.won {
  border-left: 3px solid var(--tag-green-bg);
}

.deal-card.lost {
  opacity: 0.75;
}

.deal-card.drop-before::before,
.drop-line.active {
  content: "";
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.deal-card.drop-before::before {
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
}

.drop-line {
  height: 0;
}

.deal-head {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.deal-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-menu .dropdown-trigger {
  min-height: 22px;
  padding: 0 6px;
}

.card-menu .caret {
  display: none;
}

.deal-contact {
  color: var(--text-2);
  text-decoration: none;
}

.deal-contact:hover {
  text-decoration: underline;
}

.deal-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.deal-next {
  color: var(--text-2);
}

/* ---------- Aufgaben ---------- */

.task-group {
  margin-bottom: 22px;
}

.task-group .section-title {
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.group-overdue .section-title {
  color: var(--red);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.task-row:hover {
  background: var(--bg-soft);
}

.task-check {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.task-main {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.task-title .inline-value {
  font-weight: 500;
  white-space: normal;
}

.task-row.done .task-title .inline-value {
  text-decoration: line-through;
  color: var(--text-2);
}

.task-sub {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-left: 6px;
}

.task-desc {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-due {
  min-width: 130px;
}

.task-assignee {
  min-width: 120px;
}

.task-row .row-actions {
  opacity: 0;
}

.task-row:hover .row-actions,
.task-row .row-actions:focus-within {
  opacity: 1;
}

/* ---------- Übersicht ---------- */

.dash-section {
  margin-bottom: 28px;
}

.dash-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin-bottom: 10px;
}

.dash-badge {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 12px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--tag-blue-bg);
  color: var(--tag-blue-fg);
}

.dash-badge-green {
  background: var(--tag-green-bg);
  color: var(--tag-green-fg);
}

.dash-expected .metric {
  border-top: 3px solid var(--tag-blue-bg);
}

.dash-paid .metric {
  border-top: 3px solid var(--tag-green-bg);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.metric {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.metric-head h3 {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
}

.metric-big {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

.bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 1fr 44px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.bar-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 8px;
  background: var(--hover);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  opacity: 0.75;
}

.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-list li {
  display: flex;
  flex-direction: column;
}

.mini-title {
  font-weight: 500;
}

.notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: var(--bg-soft);
}

/* ---------- Einstellungen ---------- */

.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: sticky;
  top: 16px;
}

.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-2);
}

.settings-link:hover {
  background: var(--hover);
  color: var(--text);
}

.settings-link.active {
  background: var(--active);
  color: var(--text);
  font-weight: 600;
}

.settings-link .nav-badge {
  margin-left: auto;
}

.settings-section {
  min-width: 0;
}

.settings-title {
  font-size: 20px;
  margin-bottom: 8px;
}

.settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.integration-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.integration {
  margin-bottom: 0;
}

.integration-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.integration-head h3 {
  flex: 1;
}


.gmail-settings {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.gmail-settings > summary {
  cursor: pointer;
  font-weight: 500;
  padding: 4px 0;
}

.gmail-form {
  margin-top: 8px;
}

/* Anmeldeknopf nach den Google-Markenrichtlinien (heller und dunkler Stil). */
.btn-google {
  --g-bg: #ffffff;
  --g-fg: #1f1f1f;
  --g-border: #747775;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--g-border);
  border-radius: 18px;
  background: var(--g-bg);
  color: var(--g-fg);
  font: 500 14px/1 "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.btn-google:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-google-logo {
  display: inline-flex;
}

@media (prefers-color-scheme: dark) {
  .btn-google {
    --g-bg: #131314;
    --g-fg: #e3e3e3;
    --g-border: #8e918f;
  }
}

.google-change {
  margin-top: 6px;
}

.google-setup {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.google-setup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.google-setup-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.google-steps {
  margin: 8px 0 10px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.google-redirect {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.google-redirect code {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--tag-default-bg);
  word-break: break-all;
}

.google-form {
  margin-top: 4px;
}

.jobs > summary {
  cursor: pointer;
}

.review .candidate-list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.candidate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.rules-table td,
.rules-table th {
  min-width: 110px;
}

/* Import */

.import-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.import-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.import-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.import-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.import-row.skipped {
  opacity: 0.5;
}

.import-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.import-messages {
  margin: 4px 0;
  padding-left: 18px;
  color: var(--text-2);
}

.conflicts,
.duplicates {
  margin-top: 6px;
}

.duplicates ul {
  margin: 4px 0;
  padding-left: 18px;
}

.apply-bar {
  position: sticky;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-pop);
  z-index: 20;
}

.import-result .chip-row {
  margin: 10px 0;
}

/* ---------- Mobil ---------- */

@media (max-width: 1100px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page {
    padding: 28px 28px 72px;
  }
}

@media (max-width: 860px) {
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }

  .settings-link {
    white-space: nowrap;
  }

  .integration-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 110;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow-pop);
  }

  .nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-open .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 105;
    background: rgba(15, 15, 15, 0.4);
  }

  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 6px 8px;
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .mobile-bar .icon-btn {
    min-width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .page {
    padding: 18px 16px 72px;
  }

  h1 {
    font-size: 24px;
  }

  .page-head {
    align-items: flex-start;
  }

  .nav-item,
  .nav-sub,
  .menu-item,
  .settings-link {
    min-height: 44px;
  }

  .btn {
    min-height: 40px;
  }

  .btn-small {
    min-height: 34px;
  }

  .search-input {
    max-width: none;
    flex: 1 1 100%;
  }

  .field-row {
    flex-direction: column;
  }

  .field-narrow {
    flex: 1;
  }

  .prop-row {
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
  }

  .prop-label {
    flex: none;
    padding: 2px 4px;
    font-size: 12px;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal,
  .modal-wide {
    max-width: none;
    max-height: none;
    min-height: 100%;
    border-radius: 0;
  }

  .palette-backdrop {
    padding: 0;
  }

  .palette {
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }

  .column {
    flex-basis: 84vw;
    max-height: none;
  }

  .metric-grid,
  .import-sources {
    grid-template-columns: minmax(0, 1fr);
  }

  .bell-pop {
    position: fixed;
    left: 8px;
    right: 8px;
    top: 56px;
    width: auto;
  }

  .info-pop {
    width: min(300px, 80vw);
  }

  .task-row .row-actions,
  .note-head .row-actions,
  .email-item .row-actions,
  .edit-btn,
  .inline-clear {
    opacity: 1;
  }

  .dropdown-menu {
    max-width: calc(100vw - 32px);
  }

  .toasts {
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .apply-bar {
    bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
