/* ============================================================
   Community / Forms / Tabs
   ============================================================ */
#community html,
body {
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-900);
  background: #f8fafc;
  padding-top: 30px;
}
.community-container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 32px 20px;
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  margin-bottom: 20px;
  transition: box-shadow 0.2s ease, transform 0.08s ease;
}
.card:hover {
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.08);
}

.tabs .tabbar {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 1rem;
  color: var(--ink-900);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tab-btn,
.btn,
.btn-dark {
  min-height: 44px;
}
.tab-btn:hover {
  background: #f1f5f9;
}
.tab-btn.active {
  background: var(--brand-blue-600);
  color: #fff;
  border-color: var(--brand-blue-600);
}

.tool-form {
  display: grid;
  gap: 0.75rem;
}
.address-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}
@media (min-width: 37.5em) {
  .address-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.address-form input,
.chat-input-row input,
.tool-form input,
.custom-tool-row input,
.email-field input,
.radius-field select {
  border: 1px solid #d1d5db;
  border-radius: 0.875rem;
  padding: 0.75rem 0.875rem;
  font-size: 1rem;
  min-height: 44px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.address-form input:focus,
.chat-input-row input:focus,
.tool-form input:focus,
.custom-tool-row input:focus,
.email-field input:focus,
.radius-field select:focus {
  outline: none;
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.form-hint-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.hint {
  font-size: 0.9rem;
  color: #64748b;
}
.fingerprint-info {
  font-size: 0.85rem;
  color: #334155;
  margin-top: 8px;
}

.media-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.media-preview-grid .preview-item {
  position: relative;
}
.media-preview-grid img,
.media-preview-grid video {
  width: clamp(48px, 20vw, 80px);
  height: clamp(48px, 20vw, 80px);
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.media-preview-grid .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--ink-900);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.media-preview-grid .remove-btn:hover {
  background: var(--brand-blue-600);
}

.chat-room h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 0;
}
.chat-messages {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  height: 48vh;
  overflow-y: auto;
  background: #f8fafc;
}
.chat-message {
  font-size: 1rem;
  margin-bottom: 8px;
}
.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.tool-registry h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 6px;
}
.tool-registry h4 {
  font-size: 1.1rem;
  margin: 0 0 10px;
  font-weight: 700;
}
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--ink-900);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.06s ease;
}
.chip:hover {
  background: #f3f4f6;
}
.chip:active {
  transform: translateY(1px);
}
.chip-active {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #3730a3;
}

.custom-tool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}
.selected-tools {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #334155;
}

.registry-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-top: 10px;
  align-items: end;
}
.radius-field label,
.email-field label {
  display: block;
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 6px;
}
.radius-field select {
  width: 100%;
}
.registry-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

@media (max-width: 1024px) {
  .address-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}
@media (max-width: 768px) {
  .community-container {
    padding: 24px 16px;
  }
  .address-grid {
    grid-template-columns: 1fr 1fr;
  }
  .registry-row {
    grid-template-columns: 1fr;
  }
  .tool-form {
    grid-template-columns: 1fr;
  }
  .chat-messages {
    height: 42vh;
  }
}
@media (max-width: 480px) {
  html,
  body {
    font-size: 16px;
  }
  .community-container {
    padding: 20px 12px;
  }
  .address-grid {
    grid-template-columns: 1fr;
  }
  .tab-btn {
    padding: 8px 12px;
  }
  .btn,
  .btn-dark {
    padding: 9px 14px;
  }
}
/* ============================ CRM Layout ============================ */
#CRM {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f9fafb;
  --surface: #ffffff;
  --muted: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.06);
  -webkit-font-smoothing: antialiased;

  --appbar-offset: 30px;
  padding-top: var(--appbar-offset);
  height: calc(100vh - var(--appbar-offset));
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-family: Inter, "Open Sans", system-ui, -apple-system, Segoe UI, Roboto,
    sans-serif;
  overflow: hidden;
}

#CRM > .h-full {
  display: grid !important;
  grid-template-columns: 256px 1fr;
  height: 100%;
}

#CRM > .h-full > .flex-1 {
  display: grid !important;
  grid-template-rows: 56px 1fr;
  height: 100%;
  overflow: hidden;
}

#CRM aside {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#CRM header {
  grid-row: 1 / 2;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px) saturate(1.1);
  z-index: 2;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding-inline: 16px !important;
  position: sticky;
  top: var(--appbar-offset);
}

#CRM main {
  grid-row: 2 / 3;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
  overflow-y: auto !important;
  height: 100%;
  -webkit-overflow-scrolling: touch;
}

#CRM .page-content {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

#CRM aside nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}
#CRM aside nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  transition: background 0.18s, color 0.18s, transform 0.12s, border-color 0.18s;
  border: 1px solid transparent;
}
#CRM aside nav a:hover {
  background: var(--muted);
  border-color: var(--border);
}
#CRM aside nav a svg {
  flex: 0 0 auto;
  opacity: 0.9;
  transition: transform 0.18s, opacity 0.18s;
}
#CRM aside nav a:hover svg {
  transform: translateY(-1px);
  opacity: 1;
}
#CRM aside nav a.active,
#CRM aside nav a[aria-current="page"] {
  background: #eef2ff;
  color: #1e3a8a !important;
  border-color: #c7d2fe;
  box-shadow: var(--shadow-soft);
}
#CRM aside nav a.active::before,
#CRM aside nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: var(--primary);
}
#CRM aside .px-4.py-4 {
  padding: 14px 16px !important;
  background: #ffffffcc;
  backdrop-filter: blur(6px);
}
#CRM aside .h-9.w-9 {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    #60a5fa 100%
  ) !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

#CRM .crm-topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

#CRM .topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
}
#CRM .crm-logo {
  font-weight: 600;
  color: var(--primary);
}
#CRM .crm-breadcrumb {
  color: var(--text-muted);
  font-size: 0.85rem;
}

#CRM .topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
#CRM .search-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}
#CRM .search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem 0.55rem 2.25rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
#CRM .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
#CRM .search-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  transform: translateY(-50%);
  height: 1rem;
  width: 1rem;
  color: var(--text-muted);
}

#CRM .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
#CRM .quick-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: #fff;
  transition: all 0.2s ease;
}
#CRM .quick-btn:hover {
  background: var(--muted);
}
#CRM .icon-btn.bell {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
#CRM .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #111827, #374151);
  box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0, 0, 0, 0.12);
  position: relative;
}
#CRM .avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #fff;
  border-radius: 50%;
}

#CRM .card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
#CRM .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}
#CRM .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
#CRM .kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
#CRM .kpi-card:hover {
  transform: scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.12);
}
#CRM .kpi-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
#CRM .kpi-card .value {
  font-size: 1.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}
#CRM .list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
#CRM .list-item {
  background: var(--surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
#CRM .list-item:hover {
  background: #f9fafb;
  transform: translateX(3px);
  border-color: var(--primary);
}
#CRM .list-item .title {
  font-weight: 500;
}
#CRM .list-item .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

#CRM .pill {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#CRM .pill:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
}
#CRM .timeline-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--surface);
}
#CRM .composer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--surface);
}
#CRM .composer input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  width: 100%;
}
#CRM .composer input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#CRM * {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
#CRM *::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
#CRM *::-webkit-scrollbar-track {
  background: transparent;
}
#CRM *::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
#CRM > .h-full,
#CRM > .h-full > .flex-1 {
  min-height: 0;
}

/* ============================ CRM – Contacts Page  ============================ */

#CRM .page-content .search-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}

#CRM .page-content .search-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  transform: translateY(-50%);
  height: 1rem;
  width: 1rem;
  color: var(--text-muted);
}

#CRM .page-content .search-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.55rem 0.8rem 0.55rem 2.25rem;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.1s ease;
}
#CRM .page-content .search-input:hover {
  border-color: #d1d5db;
}
#CRM .page-content .search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

#CRM .page-content select.search-input {
  padding: 0.55rem 2rem 0.55rem 0.8rem;
  background-image: linear-gradient(
      45deg,
      transparent 50%,
      var(--text-muted) 50%
    ),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position: calc(100% - 16px) 14px, calc(100% - 12px) 14px, 100% 0;
  background-size: 6px 6px, 6px 6px, 2.5rem 2.5rem;
  background-repeat: no-repeat;
  appearance: none;
  cursor: pointer;
}

#CRM .page-content .primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
#CRM .page-content .primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

#CRM .page-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

#CRM .page-content thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, var(--muted) 0%, #eef2f7 100%);
  color: #111827;
  text-align: left;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

#CRM .page-content tbody td {
  padding: 0.75rem 0.9rem;
  font-size: 0.92rem;
  vertical-align: middle;
  border-top: 1px solid var(--border);
}

#CRM .page-content tbody tr:nth-child(odd) td {
  background: #fcfcfd;
}
#CRM .page-content tbody tr:hover td {
  background: #f7fafc;
}

#CRM .page-content tbody a {
  color: #1f2937;
  text-decoration: none;
  border-bottom: 1px dashed rgba(31, 41, 55, 0.35);
  transition: color 0.15s ease, border-color 0.15s ease;
}
#CRM .page-content tbody a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

#CRM .page-content .pill {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
#CRM .page-content .pill:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
}

#CRM .page-content .icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
#CRM .page-content .icon-btn:hover {
  background: var(--muted);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.06);
}

#CRM .page-content .card > .flex.items-center.justify-between.mb-4 h2 {
  margin: 0;
}
#CRM .page-content .card > .flex.items-center.justify-between.mb-4 p {
  margin: 2px 0 0;
  color: var(--text-muted);
}

#CRM .page-content .overflow-auto {
  border-radius: calc(var(--radius) - 2px);
}

@media (max-width: 900px) {
  #CRM .page-content table thead th:nth-child(7),
  #CRM .page-content table tbody td:nth-child(7),
  #CRM .page-content table thead th:nth-child(8),
  #CRM .page-content table tbody td:nth-child(8) {
    display: none;
  }
}
@media (max-width: 900px) {
  .energy-hero-cta__inner {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
  }
  .energy-hero-cta__icon {
    justify-self: center;
  }
  .energy-hero-cta__actions {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  #CRM .page-content table thead th:nth-child(3),
  #CRM .page-content table tbody td:nth-child(3),
  #CRM .page-content table thead th:nth-child(4),
  #CRM .page-content table tbody td:nth-child(4) {
    display: none;
  }
  #CRM .page-content .search-wrapper {
    max-width: 100%;
  }
}

@media (max-width: 1200px) {
  #CRM > .h-full {
    grid-template-columns: 220px 1fr;
  }
}
@media (max-width: 1024px) {
  #CRM > .h-full {
    grid-template-columns: 72px 1fr;
  }
  #CRM aside nav a {
    justify-content: center;
    padding: 10px;
  }
  #CRM aside nav a > svg {
    margin-right: 0 !important;
  }
  #CRM aside nav a span,
  #CRM aside nav a .label {
    display: none;
  }
}
@media (max-width: 640px) {
  #CRM header .relative {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .handwerker-card {
    padding: 10px;
  }
  .handwerker-card h3 {
    font-size: 17px;
  }
  .handwerker-card .profil-button {
    width: 100%;
  }
}
