:root {
  --panel: var(--surface, #ffffff);
  --panel-solid: var(--surface, #ffffff);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* {
  box-sizing: border-box;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

body.crm-body {
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Keine automatischen Telefon-/Adress-Links (Safari iOS); optisch keine Link-Darstellung */
.crm-no-autolink a,
.crm-no-autolink a:hover,
.crm-no-autolink a:visited {
  color: inherit !important;
  font: inherit !important;
  font-weight: inherit !important;
  text-decoration: none !important;
}

.crm-no-autolink a[href^="tel:"],
.crm-no-autolink a[href^="sms:"],
.crm-no-autolink a[href^="mailto:"] {
  pointer-events: none;
  cursor: default;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-block h1 {
  margin: 0.7rem 0 0.5rem;
}

.brand-block p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.68rem 0.8rem;
  background: var(--input-bg);
  color: var(--text);
  max-width: 100%;
  min-width: 0;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: rgba(139, 152, 173, 0.75);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(100, 181, 255, 0.45);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 3px rgba(100, 181, 255, 0.15);
}

select {
  cursor: pointer;
}

.hint-message {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.error-message {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.btn,
button[type="submit"] {
  border: none;
  border-radius: 11px;
  padding: 0.7rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-primary,
button[type="submit"] {
  background: linear-gradient(180deg, rgba(100, 181, 255, 0.95), rgba(70, 140, 230, 0.88));
  color: #0a1020;
  box-shadow: 0 6px 20px rgba(60, 130, 255, 0.35), var(--glass-inset);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover,
button[type="submit"]:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  border: 1px solid var(--line-strong);
  box-shadow: var(--glass-inset);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.4rem;
  padding: 0.85rem 1.35rem;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.72);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.topbar-left {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  min-width: 0;
  flex: 1 1 12rem;
  overflow: hidden;
}

.topbar-left h1 {
  margin: 0.5rem 0 0;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip {
  font-size: clamp(0.68rem, 1.8vw, 0.85rem);
  color: var(--muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
}

.topbar-actions-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.btn-danger-text {
  color: var(--danger) !important;
  border-color: rgba(214, 64, 69, 0.35);
}

.crm-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 1.35rem 0;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 22, 0.5);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.crm-single-panel .panel {
  min-height: 400px;
}

.activity-panel-full .activity-feed-page {
  max-height: min(75vh, 900px);
  margin: 0;
  padding: 0.55rem 0.8rem 0.9rem;
}

.crm-nav-link {
  border: 1px solid transparent;
  background: transparent;
  padding: 0.45rem 0.85rem;
  border-radius: 10px 10px 0 0;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.crm-nav-link {
  text-decoration: none;
  display: inline-block;
  color: var(--muted);
}

.crm-nav-link:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
}

.crm-nav-link.is-active {
  color: var(--primary-bright);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line);
  border-bottom-color: transparent;
  box-shadow: var(--glass-inset);
}

.lead-lists-page {
  padding-top: 0.5rem;
}

.lead-lists-shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 0.9rem;
  align-items: start;
}

@media (max-width: 900px) {
  .lead-lists-shell {
    grid-template-columns: 1fr;
  }
}

.lead-lists-sidebar .panel-head {
  border-bottom: none;
  padding-bottom: 0.35rem;
}

.sidebar-hint {
  margin: 0 0.8rem 0.6rem;
  font-size: 0.82rem;
}

.lead-lists-menu {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 0.75rem;
  display: grid;
  gap: 0.35rem;
  max-height: 60vh;
  overflow: auto;
}

.lead-list-menu-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-soft);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lead-list-menu-btn:hover {
  border-color: rgba(100, 181, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.lead-list-menu-btn.is-active {
  border-color: rgba(100, 181, 255, 0.4);
  background: var(--primary-soft);
  color: var(--primary-bright);
}

.lead-list-menu-meta {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.15rem;
}

.lead-lists-head .panel-head {
  flex-wrap: wrap;
}

.lead-lists-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  width: 100%;
}

.lead-list-name-label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  min-width: 200px;
}

.lead-list-name-input[readonly] {
  cursor: default;
  background: var(--input-bg);
  color: var(--muted);
}

.lead-list-name-input {
  font-weight: 600;
}

.lead-list-meta {
  font-size: 0.82rem;
  white-space: nowrap;
}

.lead-lists-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.8rem 0.65rem;
  border-bottom: 1px solid var(--line);
}

.toolbar-hint {
  margin: 0;
  flex: 1;
  min-width: 200px;
  font-size: 0.8rem;
}

.lead-sheet-wrap:not(.leads-sheet-scroll) {
  max-height: min(70vh, 720px);
  margin: 0.75rem 0.8rem 0.9rem;
}

.lead-sheet-table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.lead-sheet-table th,
.lead-sheet-table td {
  border: 1px solid var(--line);
  padding: 0;
  vertical-align: middle;
}

.lead-sheet-table thead th {
  background: rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 1;
}

.lead-th-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
}

.lead-col-label {
  flex: 1;
  min-width: 72px;
  border: none !important;
  border-radius: 6px;
  padding: 0.35rem 0.4rem !important;
  background: transparent;
  font-weight: 600;
}

.lead-col-remove {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 6px;
  background: rgba(214, 64, 69, 0.12);
  color: var(--danger);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.lead-col-remove:hover {
  background: rgba(214, 64, 69, 0.22);
}

.lead-cell {
  width: 100%;
  min-width: 120px;
  border: none !important;
  border-radius: 0;
  padding: 0.45rem 0.5rem !important;
  background: transparent;
  color: var(--text-soft);
}

.lead-cell-view {
  padding: 0.45rem 0.5rem;
  min-height: 2.35em;
  word-break: break-word;
  font-size: 0.84rem;
  color: var(--text-soft);
  background: transparent;
}

.lead-cell-view--empty {
  color: var(--muted);
}

.lead-firma-send-btn.lead-firma-view-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  color: #b71c1c !important;
  -webkit-appearance: none;
  appearance: none;
  -webkit-touch-callout: none;
}

.lead-firma-send-btn.lead-firma-view-btn:hover {
  text-decoration: underline;
  text-decoration-color: rgba(183, 28, 28, 0.45);
}

.lead-firma-missing-cell {
  padding: 0.5rem 0.75rem !important;
  background: rgba(245, 184, 74, 0.08);
  border-top: 1px solid rgba(245, 184, 74, 0.2);
}

.lead-phone-broadcast-missing-cell {
  padding: 0.5rem 0.75rem !important;
  background: rgba(100, 181, 255, 0.06);
  border-top: 1px solid rgba(100, 181, 255, 0.2);
}

.lead-phone-wrap {
  position: relative;
  min-width: 120px;
}

.lead-phone-wrap.crm-no-autolink {
  -webkit-tap-highlight-color: transparent;
}

.lead-phone-wrap .lead-cell-phone-input {
  width: 100%;
}

/* Gültige Nummer: echtes <input> ausblenden, nur die Schaltfläche zeigt (kein OS-Telefon-Link auf dem Feld). */
.lead-phone-wrap.lead-phone-wrap--masked .lead-cell-phone-input {
  display: none !important;
}

.lead-phone-dial-row {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.5rem;
  gap: 0.35rem;
  background: transparent;
  min-height: calc(0.45rem * 2 + 1.35em);
}

.lead-phone-wrap.lead-phone-wrap--editing .lead-phone-dial-row {
  display: none;
}

.lead-phone-dial-row.hidden {
  display: none !important;
}

.lead-tel-dial {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
  padding: 0.15rem 0.25rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  -webkit-touch-callout: none;
}

.lead-tel-dial:hover {
  background: rgba(17, 32, 56, 0.06);
}

.lead-tel-remote {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
  text-decoration: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 0.2rem 0.45rem;
  margin: 0;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

.lead-tel-remote:hover {
  background: #cfe0ff;
  color: #1f52cc;
}

.incoming-call-number {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0.5rem 0 1rem;
  word-break: break-all;
}

.incoming-call-number.incoming-call-firma-text {
  color: #b71c1c;
}

.incoming-call-number.incoming-call-tel-display {
  color: #0d47a1;
}

.modal-actions--intent-call {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-actions--intent-call a.btn.btn-primary {
  text-decoration: none;
}

.modal-actions--intent-call a.btn.btn-primary[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

.crm-app-toast {
  position: fixed;
  z-index: 9999;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: rgba(28, 34, 46, 0.92);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.88rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: center;
}

.crm-app-toast.hidden {
  display: none;
}

.lead-phone-edit-btn {
  flex-shrink: 0;
  border: none;
  background: rgba(42, 103, 255, 0.1);
  color: var(--primary);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}

.lead-phone-edit-btn:hover {
  background: rgba(42, 103, 255, 0.18);
}

.empty-lead-sheet {
  padding: 1rem 0.8rem;
}

.lead-th-readonly .lead-col-label-readonly {
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.35rem 0.4rem;
  display: block;
}

.import-step-file {
  padding: 0 0.25rem;
}

.import-mapping-wrap {
  margin-top: 0.75rem;
}

.import-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.import-map-table th,
.import-map-table td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.import-map-table select.import-map-select {
  width: 100%;
  min-width: 200px;
}

.import-sample {
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 280px;
}

.fields-table-wrap {
  max-height: 360px;
  margin-bottom: 1rem;
}

.fields-def-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.fields-def-table th,
.fields-def-table td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.5rem;
  vertical-align: middle;
}

.field-key-cell {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.field-edit-label,
.field-edit-sort {
  width: 100%;
  min-width: 120px;
}

.field-actions {
  white-space: nowrap;
}

.field-actions .link-btn {
  margin-right: 0.15rem;
}

.new-field-form {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.25rem;
}

.crm-layout {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.5rem 1.7rem;
}

/* Pipeline: Kanban füllt den verfügbaren Bereich, kein Seiten-Scroll */
#viewPipeline #crmApp.crm-layout {
  flex: 1;
  min-height: 0;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem 1rem;
  overflow: hidden;
}

#viewPipeline #crmApp.crm-layout:has(.pipeline-topbar-details:not([open])) {
  gap: 0.5rem;
}

.pipeline-topbar-details {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(20, 26, 38, 0.5);
  box-shadow: var(--shadow-soft), var(--glass-inset);
  overflow: hidden;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.pipeline-topbar-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.65rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

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

.pipeline-topbar-summary__title {
  color: var(--text);
}

.pipeline-topbar-summary__chev {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 6px;
  background: rgba(42, 103, 255, 0.08);
  position: relative;
}

.pipeline-topbar-summary__chev::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: translate(-50%, -50%) rotate(45deg);
  transition: transform 0.2s ease;
}

.pipeline-topbar-details[open] .pipeline-topbar-summary__chev::after {
  top: 55%;
  transform: translate(-50%, -50%) rotate(-135deg);
}

.pipeline-topbar-details > summary:hover {
  background: rgba(42, 103, 255, 0.05);
  color: var(--text);
}

.pipeline-topbar-body {
  display: grid;
  gap: 0.55rem;
  padding: 0 0.55rem 0.55rem;
  min-width: 0;
  max-width: 100%;
}

.pipeline-topbar-details[open] .pipeline-topbar-body {
  max-height: min(32vh, 240px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pipeline-topbar-body .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 0.45rem;
}

.pipeline-topbar-body .stat-card {
  padding: 0.5rem 0.6rem;
  border-radius: 11px;
  box-shadow: var(--shadow-soft);
}

.pipeline-topbar-body .stat-card p {
  font-size: 0.72rem;
}

.pipeline-topbar-body .stat-card strong {
  font-size: 1.02rem;
  margin-top: 0.2rem;
}

.pipeline-topbar-body .filter-bar {
  padding: 0.45rem 0.55rem;
  gap: 0.45rem;
  border-radius: 11px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr));
  box-shadow: var(--shadow-soft);
}

.pipeline-topbar-body .filter-group label {
  font-size: 0.72rem;
}

.pipeline-topbar-body .filter-group input,
.pipeline-topbar-body .filter-group select {
  padding: 0.38rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 9px;
}

.pipeline-topbar-body .filter-actions {
  gap: 0.35rem;
}

.pipeline-topbar-body .filter-actions .btn,
.pipeline-topbar-body .filter-actions .import-label.btn {
  padding: 0.38rem 0.55rem;
  font-size: 0.76rem;
  border-radius: 9px;
}

body.crm-body:has(#viewPipeline:not(.hidden)) #toolbarPipeline .btn {
  padding: 0.48rem 0.72rem;
  font-size: 0.82rem;
  border-radius: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.8rem;
  min-width: 0;
  max-width: 100%;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
  border-color: rgba(100, 181, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-soft);
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
}

.stat-card strong {
  margin-top: 0.4rem;
  display: block;
  font-size: clamp(0.9rem, 2.5vw, 1.26rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 0.65rem;
  min-width: 0;
  max-width: 100%;
}

.filter-group {
  display: grid;
  gap: 0.35rem;
}

.filter-group label {
  font-size: 0.8rem;
}

.filter-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.filter-actions .btn,
.filter-actions .import-label {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.import-label {
  display: inline-flex;
  align-items: center;
}

#viewPipeline .board-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board-section {
  background: rgba(18, 24, 34, 0.45);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), var(--glass-inset);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

.pipeline-board {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.85rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.phase-column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.65rem 0.65rem;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: var(--glass-inset);
  position: relative;
  container-type: inline-size;
  container-name: phase-col;
}

.phase-column::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0.65rem;
  right: 0.65rem;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--phase-accent, linear-gradient(90deg, #2563eb, #60a5fa));
  opacity: 0.9;
}

.phase-column:nth-child(5n + 1) { --phase-accent: linear-gradient(90deg, #2563eb, #60a5fa); }
.phase-column:nth-child(5n + 2) { --phase-accent: linear-gradient(90deg, #7c3aed, #a78bfa); }
.phase-column:nth-child(5n + 3) { --phase-accent: linear-gradient(90deg, #0d9f6e, #34d399); }
.phase-column:nth-child(5n + 4) { --phase-accent: linear-gradient(90deg, #d97706, #fbbf24); }
.phase-column:nth-child(5n + 5) { --phase-accent: linear-gradient(90deg, #dc2626, #f87171); }

.phase-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
  min-width: 0;
  max-width: 100%;
}

.phase-head > div:first-child {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.phase-name {
  font-weight: 700;
  font-size: clamp(0.72rem, 4cqi + 0.35rem, 0.95rem);
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.phase-meta {
  margin: 0.2rem 0 0;
  font-size: clamp(0.62rem, 3cqi + 0.3rem, 0.78rem);
  color: var(--muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.phase-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0;
  width: 1.85rem;
  height: 1.85rem;
  min-width: 1.85rem;
  max-width: 1.85rem;
  flex: 0 0 1.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.phase-actions button.phase-action-delete:hover {
  border-color: rgba(255, 107, 122, 0.35);
  color: var(--danger);
}

.phase-actions button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(100, 181, 255, 0.35);
  color: var(--primary-bright);
}

.phase-dropzone {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  gap: 0.65rem;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding: 0.1rem 0.15rem 0.15rem 0;
  margin-right: -0.05rem;
}

.phase-dropzone::-webkit-scrollbar {
  width: 6px;
}

.phase-dropzone::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.phase-dropzone::-webkit-scrollbar-thumb {
  background: rgba(100, 181, 255, 0.28);
  border-radius: 999px;
}

.phase-dropzone::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 181, 255, 0.42);
}

.phase-dropzone.drag-over {
  background: rgba(100, 181, 255, 0.06);
  outline: 2px dashed rgba(100, 181, 255, 0.45);
  outline-offset: -2px;
  border-radius: 10px;
}

.deal-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: clamp(0.5rem, 2cqi + 0.25rem, 0.75rem);
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
  transition: box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.deal-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(100, 181, 255, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.deal-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}

.deal-card h4 {
  margin: 0;
  font-size: clamp(0.78rem, 3.5cqi + 0.35rem, 0.92rem);
  font-weight: 700;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
}

.deal-company,
.deal-meta,
.deal-next-step {
  margin: 0;
  font-size: clamp(0.72rem, 3cqi + 0.3rem, 0.88rem);
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.deal-audit {
  margin: 0;
  font-size: clamp(0.68rem, 3cqi + 0.28rem, 0.82rem);
  color: var(--muted);
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.priority-pill {
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.priority-hoch {
  background: rgba(255, 107, 122, 0.15);
  color: #ff9aa5;
}

.priority-mittel {
  background: rgba(245, 184, 74, 0.15);
  color: #f5c76a;
}

.priority-niedrig {
  background: rgba(61, 214, 140, 0.12);
  color: #6ee7a8;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
}

.tag {
  background: rgba(100, 181, 255, 0.1);
  color: var(--primary-bright);
  border: 1px solid rgba(100, 181, 255, 0.2);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
}

.deal-card footer {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.deal-card footer .link-btn,
.deal-open-btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.link-btn {
  border: 1px solid rgba(100, 181, 255, 0.22);
  background: rgba(100, 181, 255, 0.1);
  padding: 0.48rem 0.7rem;
  color: var(--primary-bright);
  font-size: clamp(0.72rem, 3cqi + 0.28rem, 0.82rem);
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-btn:hover {
  background: rgba(100, 181, 255, 0.18);
  border-color: rgba(100, 181, 255, 0.4);
}

.link-btn.danger {
  color: var(--danger);
  border-color: rgba(255, 107, 122, 0.3);
  background: rgba(255, 107, 122, 0.08);
}

.deal-open-btn {
  text-align: center;
}

/* Enge Spalten: kompaktere Karten */
@container phase-col (max-width: 10.5rem) {
  .phase-actions button {
    width: 1.65rem;
    height: 1.65rem;
    min-width: 1.65rem;
    max-width: 1.65rem;
    flex-basis: 1.65rem;
    font-size: 0.78rem;
  }

  .deal-card {
    padding: 0.45rem;
    gap: 0.35rem;
  }

  .tag-list {
    gap: 0.2rem;
  }

  .tag {
    font-size: 0.62rem;
    padding: 0.12rem 0.35rem;
  }
}

.grid-two {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1.2fr 0.8fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-height: 280px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.04rem;
}

.panel-head input {
  max-width: 240px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.86rem;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-bright);
}

.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0.55rem 0.8rem 0.9rem;
  display: grid;
  gap: 0.5rem;
  max-height: 355px;
  overflow: auto;
}

.activity-feed li {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  font-size: 0.84rem;
}

.activity-body {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.activity-time {
  color: var(--muted);
  margin-bottom: 0.3rem;
  display: block;
  font-size: 0.75rem;
}

.modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(860px, 94vw);
  background: transparent;
}

.modal::backdrop {
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Lead-/Intent-Meldung: grauer Hintergrund, Karte von oben */
.modal--intent-announce::backdrop {
  background: rgba(4, 6, 12, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: crmIntentBackdropIn 0.32s ease-out;
}

.modal--intent-announce .modal-card--intent-announce {
  animation: crmIntentCardSlideIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

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

@keyframes crmIntentCardSlideIn {
  from {
    opacity: 0;
    transform: translateY(-36px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-card {
  background: rgba(22, 28, 38, 0.88);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--glass-inset);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.modal-card h3 {
  margin: 0;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.modal-grid .full-width {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-wide {
  width: min(960px, 96vw);
}

.deal-comments-panel {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.35rem;
  display: grid;
  gap: 0.55rem;
}

.comments-heading {
  margin: 0;
  font-size: 1rem;
}

.comments-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.deal-comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-height: 220px;
  overflow: auto;
}

.deal-comment-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.03);
}

.deal-comment-head {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.deal-comment-text {
  margin: 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.comments-actions {
  display: flex;
  justify-content: flex-start;
}

.users-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
}

.users-panel h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.users-table-wrap {
  max-height: 320px;
}

.users-table {
  font-size: 0.88rem;
}

.user-form-actions {
  justify-content: flex-end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
}

.muted {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.hidden {
  display: none !important;
}

/* —— Kunden & Projekte —— */
.panel-head--split {
  flex-wrap: wrap;
  align-items: flex-start;
}

.panel-head--split > div {
  min-width: 0;
  flex: 1 1 12rem;
}

.panel-head--plain {
  border-bottom: none;
  padding-bottom: 0.35rem;
}

.panel-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.panel-head--split input[type="search"],
.projects-filter-row input[type="search"],
.projects-filter-row select {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 10rem;
}

.customers-panel-full,
.projects-list-panel {
  min-height: min(70vh, 800px);
  display: flex;
  flex-direction: column;
}

.customers-stats,
.projects-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 0.65rem;
  padding: 0 0.8rem 0.75rem;
}

.customers-table-wrap,
.projects-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0 0.8rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.customers-table,
.projects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.customers-table th,
.customers-table td,
.projects-table th,
.projects-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.6rem;
  vertical-align: top;
  text-align: left;
}

.customers-table th,
.projects-table th {
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  white-space: nowrap;
}

.table-actions .link-btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.76rem;
}

.table-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-aktiv,
.status-project-aktiv {
  background: rgba(61, 214, 140, 0.12);
  color: #6ee7a8;
}

.status-inaktiv,
.status-project-abgeschlossen {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.status-project-geplant {
  background: rgba(100, 181, 255, 0.12);
  color: var(--primary-bright);
}

.status-project-pausiert {
  background: rgba(245, 184, 74, 0.12);
  color: #f5c76a;
}

.empty-hint {
  margin: 0.5rem 0.9rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.customer-projects-panel {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.25rem;
}

.customer-projects-heading {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

.customer-linked-projects {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.customer-linked-project-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.customer-linked-project-info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.customer-linked-project-info strong {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-linked-project-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.customer-linked-project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex-shrink: 0;
}

.customer-link-project-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.customer-link-project-row label {
  font-size: 0.8rem;
  color: var(--muted);
}

.customer-link-project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.customer-link-project-actions select {
  flex: 1 1 12rem;
  min-width: 0;
}

.customer-add-project-btn {
  width: 100%;
  max-width: 100%;
}

.customer-projects-empty {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
}

.project-customer-cell.is-linked {
  color: var(--primary);
  font-weight: 600;
}

.project-customer-cell.is-linked:hover {
  text-decoration: underline;
}

.project-customer-cell.is-unlinked {
  color: var(--warning);
  font-style: italic;
}

.active-project-customer.is-clickable {
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.active-project-customer.is-clickable:hover {
  text-decoration: underline;
}

.crm-projects-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  padding: 1rem 1.5rem 1.7rem;
}

.projects-overview {
  padding-bottom: 0.85rem;
}

.projects-overview .panel-head {
  padding: 0.8rem 0.8rem 0.35rem;
}

.active-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 0.75rem;
  padding: 0 0.8rem 0.85rem;
}

.active-project-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  box-shadow: var(--shadow-soft), var(--glass-inset);
}

.active-project-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 0;
}

.active-project-card h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-project-customer,
.active-project-range,
.active-project-progress {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.project-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.project-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4a9eff, #64d4ff);
  border-radius: 999px;
}

.active-project-tasks {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.active-project-tasks li.is-done {
  text-decoration: line-through;
  color: var(--muted);
}

.active-project-tasks li.is-more,
.active-project-tasks li.is-muted {
  list-style: none;
  margin-left: -1.1rem;
  color: var(--muted);
  font-style: italic;
}

.projects-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  min-width: 0;
  flex: 1 1 14rem;
  justify-content: flex-end;
}

@media (max-width: 1040px) {
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.65rem 0.85rem;
    gap: 0.55rem;
  }

  .topbar-left h1 {
    font-size: 1.15rem;
    margin: 0.35rem 0 0;
  }

  .user-chip {
    font-size: 0.78rem;
  }

  .crm-subnav {
    padding: 0.32rem 0.75rem 0;
    gap: 0.28rem;
  }

  .crm-nav-link {
    padding: 0.34rem 0.55rem;
    font-size: 0.82rem;
    border-radius: 8px 8px 0 0;
  }

  .filter-actions {
    justify-content: flex-start;
  }

  #viewPipeline #crmApp.crm-layout {
    padding: 0.65rem 0.75rem 0.75rem;
  }

  .pipeline-board {
    gap: 0.5rem;
    padding: 0.55rem;
  }

  .phase-column {
    padding: 0.55rem 0.45rem 0.45rem;
  }

  .phase-name {
    font-size: 0.82rem;
  }

  .phase-meta {
    font-size: 0.7rem;
  }

  .crm-layout,
  .crm-projects-layout {
    padding: 0.9rem;
  }

  .panel-head--split input[type="search"] {
    width: 100%;
  }

  body.crm-body:has(#viewPipeline:not(.hidden)) #toolbarPipeline .btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.74rem;
  }

  .pipeline-topbar-details[open] .pipeline-topbar-body {
    max-height: min(38vh, 280px);
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0.45rem 0.55rem;
    gap: 0.4rem;
  }

  .topbar-left {
    gap: 0.15rem;
  }

  .brand-pill {
    font-size: 0.7rem;
    padding: 0.18rem 0.5rem;
  }

  .topbar-left h1 {
    font-size: 1rem;
    margin: 0.2rem 0 0;
    line-height: 1.2;
  }

  .user-chip {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .topbar-right {
    gap: 0.3rem;
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-right .btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
  }

  .topbar-actions-group .btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
  }

  .crm-subnav {
    padding: 0.22rem 0.45rem 0;
    gap: 0.15rem;
  }

  .crm-nav-link {
    padding: 0.28rem 0.42rem;
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: 7px 7px 0 0;
  }
}
