/*
 * BRAHIMI Firmenzentrale – CRM V0.3A2
 * Responsive Pipeline, eindeutige Aktionen und ruhige, deckende Navigation.
 */

/* Die sticky Kopfzeile darf beim Scrollen keine Inhalte durchscheinen lassen. */
.topbar{
  background:#fff;
  -webkit-backdrop-filter:none;
  backdrop-filter:none;
  box-shadow:0 8px 24px rgba(23,50,77,.08);
}

.crm-hero,
.crm-detail-hero{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:28px;
  padding:30px 32px;
  border-radius:24px;
  background:linear-gradient(135deg,#163c60,#24669b);
  color:#fff;
  margin-bottom:22px;
  box-shadow:0 16px 38px rgba(23,50,77,.14);
}
.crm-hero-copy{min-width:0}
.crm-hero h1,
.crm-detail-hero h1{
  margin:8px 0;
  font-size:clamp(32px,4vw,44px);
  line-height:1.08;
}
.crm-hero p,
.crm-detail-hero p{
  margin:0;
  color:#dceaf6;
  line-height:1.5;
}
.crm-hero-actions,
.crm-detail-actions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  align-self:center;
}

.crm-action,
.primary-link-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:48px;
  padding:12px 17px;
  border:1px solid transparent;
  border-radius:13px;
  text-decoration:none;
  font-weight:900;
  line-height:1.15;
  white-space:nowrap;
  transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
}
.crm-action:hover,
.primary-link-button:hover{
  transform:translateY(-1px);
}
.crm-action-primary,
.primary-link-button{
  background:#fff;
  color:#17324d;
  box-shadow:0 8px 22px rgba(7,28,48,.18);
}
.crm-action-secondary{
  border-color:rgba(255,255,255,.42);
  background:rgba(255,255,255,.12);
  color:#fff;
}
.crm-action-secondary:hover{
  background:rgba(255,255,255,.20);
}

/* Vorhandene globale Secondary-Buttons im blauen CRM-Header lesbar halten. */
.crm-hero .secondary-button,
.crm-detail-hero .secondary-button{
  color:#17324d;
  background:#fff;
}

.crm-kpis{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin-bottom:24px;
}
.crm-kpis article{
  min-height:102px;
  padding:18px 20px;
  border:1px solid var(--line);
  border-radius:17px;
  background:#fff;
  box-shadow:0 8px 22px rgba(23,50,77,.04);
}
.crm-kpis span,
.crm-kpis strong{display:block}
.crm-kpis span{color:var(--muted)}
.crm-kpis strong{
  font-size:30px;
  margin-top:7px;
}

.crm-pipeline-section{margin-bottom:22px}
.crm-section-heading{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  margin:0 3px 13px;
}
.crm-section-heading h2{
  margin:0 0 4px;
  font-size:22px;
}
.crm-section-heading p{
  margin:0;
  color:var(--muted);
}
.crm-section-heading>a{
  color:var(--blue);
  text-decoration:none;
  font-weight:850;
  white-space:nowrap;
}

/*
 * Auf MacBook-/Desktopbreite passen alle neun Phasen ohne horizontalen
 * Scrollbalken. Auf kleineren Ansichten wird sauber umgebrochen.
 */
.crm-pipeline{
  display:grid;
  grid-template-columns:repeat(9,minmax(0,1fr));
  gap:10px;
  overflow:visible;
  padding:0;
  margin:0;
}
.crm-pipeline a{
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:126px;
  padding:14px 13px;
  border:1px solid var(--line);
  border-radius:15px;
  background:#fff;
  color:var(--ink);
  text-decoration:none;
  box-shadow:0 7px 20px rgba(23,50,77,.035);
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
.crm-pipeline a:hover{
  transform:translateY(-2px);
  border-color:#a9c3d8;
  box-shadow:0 10px 25px rgba(23,50,77,.08);
}
.crm-pipeline a.active{
  border-color:var(--blue);
  background:#edf5fb;
  box-shadow:0 0 0 3px rgba(31,91,143,.12);
}
.crm-pipeline span,
.crm-pipeline strong,
.crm-pipeline small{display:block}
.crm-pipeline span{
  min-height:34px;
  font-size:14px;
  font-weight:800;
  line-height:1.18;
  overflow-wrap:anywhere;
}
.crm-pipeline strong{
  margin:8px 0 5px;
  font-size:27px;
  line-height:1;
}
.crm-pipeline small{
  margin-top:auto;
  color:var(--muted);
  font-size:12px;
}

.crm-filter-panel{
  padding:17px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  margin-bottom:20px;
  box-shadow:0 8px 22px rgba(23,50,77,.035);
}
.crm-filter-panel form{
  display:grid;
  grid-template-columns:
    minmax(280px,2.1fr)
    minmax(175px,1fr)
    minmax(175px,1fr)
    minmax(190px,auto)
    auto
    auto;
  gap:12px;
  align-items:end;
}
.crm-filter-field{
  display:grid;
  gap:6px;
  min-width:0;
}
.crm-filter-field>span{
  color:var(--muted);
  font-size:12px;
  font-weight:850;
}
.crm-filter-panel input[type=search],
.crm-filter-panel select{
  width:100%;
  min-height:48px;
  padding:11px 13px;
  border:1px solid #cad6e4;
  border-radius:11px;
  background:#fff;
  color:var(--ink);
  font:inherit;
}
.crm-filter-panel input[type=search]:focus,
.crm-filter-panel select:focus{
  outline:3px solid rgba(31,91,143,.13);
  border-color:var(--blue);
}
.crm-check{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:48px;
  padding:0 12px;
  border:1px solid #d7e0ea;
  border-radius:11px;
  background:#f8fafc;
  font-size:13px;
  font-weight:750;
  white-space:nowrap;
}
.crm-check input{
  width:18px;
  height:18px;
  margin:0;
}
.crm-filter-button{
  min-height:48px;
  padding:11px 18px;
  border:0;
  border-radius:11px;
  background:var(--blue);
  color:#fff;
  font-weight:900;
  cursor:pointer;
}
.crm-reset-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  padding:0 5px;
  color:var(--blue2);
  text-decoration:none;
  font-weight:900;
  white-space:nowrap;
}

.crm-list-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}
.crm-table td small{
  display:block;
  margin-top:4px;
  color:var(--muted);
}
.crm-stage,
.crm-priority{
  display:inline-block;
  padding:5px 9px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
}
.crm-stage{background:#e8f1f8;color:#245779}
.stage-won{background:#ddf5e9;color:#176a49}
.stage-lost{background:#fce8e8;color:#983c3c}
.crm-priority{background:#eef1f5;color:#4f5f70}
.priority-high{background:#fff3d4;color:#805b00}
.priority-urgent{background:#fde4e4;color:#a23131}
.crm-overdue{color:#b33b3b;font-weight:900}

.crm-empty-state{
  display:grid;
  justify-items:center;
  padding:48px 24px 52px;
  text-align:center;
  background:
    radial-gradient(circle at 50% 0%,#edf5fb 0,transparent 55%),
    #fff;
}
.crm-empty-icon{
  display:grid;
  place-items:center;
  width:68px;
  height:68px;
  margin-bottom:15px;
  border-radius:21px;
  background:#eaf3fa;
  font-size:34px;
}
.crm-empty-state h3{
  margin:0 0 8px;
  font-size:24px;
}
.crm-empty-state p{
  max-width:620px;
  margin:0 0 21px;
  color:var(--muted);
  line-height:1.55;
}
.crm-empty-primary,
.crm-empty-secondary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:46px;
  padding:11px 17px;
  border-radius:12px;
  text-decoration:none;
  font-weight:900;
}
.crm-empty-primary{
  background:var(--blue);
  color:#fff;
}
.crm-empty-secondary{
  background:#eaf0f6;
  color:var(--blue2);
}

.crm-pagination{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:18px 22px;
  border-top:1px solid var(--line);
}
.crm-pagination a{
  color:var(--blue);
  font-weight:850;
  text-decoration:none;
}

/* Formulare und Detailansicht */
.crm-form-heading{display:flex;justify-content:space-between}
.crm-lead-form .crm-input,
.crm-compact-form .crm-input{
  width:100%;
  padding:11px 12px;
  border:1px solid #cad6e4;
  border-radius:10px;
  background:#fff;
}
.crm-wide-grid{grid-template-columns:1fr 1fr}
.crm-title-line{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.crm-detail-actions form{margin:0}
.danger-button{
  padding:12px 16px;
  border:0;
  border-radius:12px;
  background:#fde4e4;
  color:#9c3131;
  font-weight:900;
}
.crm-detail-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-bottom:18px;
}
.crm-info-card,
.crm-notes-card,
.crm-work-card{
  padding:22px;
  border:1px solid var(--line);
  border-radius:20px;
  background:#fff;
}
.crm-info-card h2,
.crm-work-card h2,
.crm-notes-card h2{margin:0 0 16px}
.crm-info-card dl{
  display:grid;
  grid-template-columns:145px 1fr;
  gap:10px;
  margin:0;
}
.crm-info-card dt{font-weight:850;color:var(--muted)}
.crm-info-card dd{margin:0}
.crm-notes-card{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:22px;
  margin-bottom:18px;
}
.crm-notes-card p{line-height:1.55;margin:0}
.crm-work-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}
.crm-item-list{
  display:grid;
  gap:10px;
  margin-bottom:14px;
}
.crm-list-item{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:13px;
  border:1px solid var(--line);
  border-radius:13px;
  background:#f9fbfd;
}
.crm-list-item.completed{opacity:.58}
.crm-list-item strong,
.crm-list-item small{display:block}
.crm-list-item small{margin-top:4px;color:var(--muted)}
.crm-list-item p{margin:8px 0 0;line-height:1.45}
.crm-list-item button{
  border:0;
  border-radius:9px;
  padding:8px 10px;
  font-weight:850;
}
.empty-note{color:var(--muted)}
.crm-work-card details{
  border-top:1px solid var(--line);
  padding-top:13px;
}
.crm-work-card summary{
  cursor:pointer;
  color:var(--blue);
  font-weight:900;
}
.crm-compact-form{
  display:grid;
  gap:11px;
  margin-top:14px;
}
.crm-compact-form label{
  display:grid;
  gap:5px;
  font-weight:800;
}
.crm-compact-form button{
  padding:11px 14px;
  border:0;
  border-radius:10px;
  background:var(--blue);
  color:#fff;
  font-weight:900;
}

@media(max-width:1200px){
  .crm-filter-panel form{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .crm-search-field{grid-column:span 2}
  .crm-filter-button,
  .crm-reset-link{width:100%}
}

@media(max-width:1150px){
  .crm-pipeline{grid-template-columns:repeat(3,minmax(0,1fr))}
  .crm-pipeline a{min-height:112px}
}

@media(max-width:900px){
  .crm-work-grid{grid-template-columns:1fr}
}

@media(max-width:760px){
  .crm-hero,
  .crm-detail-hero{flex-direction:column}
  .crm-hero-actions,
  .crm-detail-actions{
    width:100%;
    justify-content:stretch;
  }
  .crm-action,
  .crm-detail-actions a,
  .crm-detail-actions form{flex:1}
  .crm-detail-actions button{width:100%}
  .crm-kpis,
  .crm-detail-grid,
  .crm-notes-card,
  .crm-wide-grid{grid-template-columns:1fr}
  .crm-filter-panel form{grid-template-columns:1fr}
  .crm-search-field{grid-column:auto}
  .crm-info-card dl{grid-template-columns:1fr}
  .crm-list-heading,
  .crm-section-heading{
    align-items:flex-start;
    flex-direction:column;
  }
}

@media(max-width:620px){
  .crm-pipeline{grid-template-columns:repeat(2,minmax(0,1fr))}
  .crm-action{width:100%}
}

@media(max-width:410px){
  .crm-pipeline{grid-template-columns:1fr}
}


/* V0.3A4 – CRM-Archiv und Wiederherstellung */
.crm-archive-hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:26px;
  padding:28px 32px;
  margin-bottom:20px;
  border-radius:24px;
  background:linear-gradient(135deg,#253e57,#47677f);
  color:#fff;
  box-shadow:0 16px 38px rgba(23,50,77,.14);
}
.crm-archive-hero .back-link{
  display:inline-block;
  margin-bottom:16px;
  color:#dceaf6;
}
.crm-archive-hero .eyebrow{
  display:block;
  color:#dceaf6;
}
.crm-archive-hero h1{
  margin:7px 0 8px;
  font-size:clamp(32px,4vw,44px);
}
.crm-archive-hero p{
  max-width:720px;
  margin:0;
  color:#dceaf6;
  line-height:1.5;
}
.crm-archive-count{
  flex:0 0 auto;
  min-width:190px;
  padding:17px 20px;
  border:1px solid rgba(255,255,255,.3);
  border-radius:17px;
  background:rgba(255,255,255,.1);
}
.crm-archive-count span,
.crm-archive-count strong{display:block}
.crm-archive-count span{
  color:#dceaf6;
  font-size:13px;
  font-weight:800;
}
.crm-archive-count strong{
  margin-top:6px;
  font-size:32px;
}
.crm-archive-filter form{
  grid-template-columns:
    minmax(280px,2fr)
    minmax(180px,1fr)
    minmax(180px,1fr)
    auto
    auto;
}
.crm-archive-table form{margin:0}
.crm-restore-button{
  min-height:40px;
  padding:9px 13px;
  border:0;
  border-radius:10px;
  background:#def4e8;
  color:#176a49;
  font-weight:900;
  cursor:pointer;
}
.crm-restore-button:hover{background:#c9ecd9}
.crm-archive-empty{
  background:
    radial-gradient(circle at 50% 0%,#eef3f7 0,transparent 58%),
    #fff;
}

@media(max-width:1000px){
  .crm-archive-filter form{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .crm-archive-filter .crm-search-field{grid-column:span 2}
}

@media(max-width:700px){
  .crm-archive-hero{
    align-items:flex-start;
    flex-direction:column;
  }
  .crm-archive-count{
    width:100%;
    min-width:0;
  }
  .crm-archive-filter form{grid-template-columns:1fr}
  .crm-archive-filter .crm-search-field{grid-column:auto}
}


/* BRAHIMI Firmenzentrale – CRM V0.3.5 Wiedervorlagen */
.crm-followup-panel,
.crm-followup-filter-card,
.crm-followup-results,
.crm-followup-page-hero {
  background:#fff;
  border:1px solid #d8e2ee;
  border-radius:28px;
  box-shadow:0 14px 34px rgba(31,67,101,.08);
  margin:28px 0;
  padding:30px;
}
.crm-followup-heading,
.crm-followup-result-heading {
  align-items:flex-start;
  display:flex;
  gap:24px;
  justify-content:space-between;
}
.crm-followup-heading h2,
.crm-followup-result-heading h2,
.crm-followup-page-hero h1 {
  color:#11243f;
  margin:.2rem 0 .45rem;
}
.crm-followup-heading p,
.crm-followup-result-heading p,
.crm-followup-page-hero p {
  color:#63758d;
  margin:0;
}
.crm-followup-all-button,
.crm-followup-filter-form button,
.crm-followup-open-cell a {
  background:#165f96;
  border:0;
  border-radius:14px;
  color:#fff;
  display:inline-flex;
  font-weight:800;
  justify-content:center;
  padding:13px 18px;
  text-decoration:none;
}
.crm-followup-stats {
  display:grid;
  gap:14px;
  grid-template-columns:repeat(4,minmax(0,1fr));
  margin:24px 0;
}
.crm-followup-stat {
  background:#f3f7fb;
  border:1px solid #d9e4ef;
  border-radius:18px;
  color:#344a63;
  display:flex;
  flex-direction:column;
  gap:6px;
  min-height:104px;
  padding:18px;
  text-decoration:none;
}
.crm-followup-stat strong {
  color:#102440;
  font-size:2rem;
  line-height:1;
}
.crm-followup-stat.is-overdue {
  background:#fff1f1;
  border-color:#f2c4c4;
}
.crm-followup-stat.is-today {
  background:#fff8e6;
  border-color:#efd796;
}
.crm-followup-stat.is-upcoming {
  background:#eef8ff;
  border-color:#bfdcf0;
}
.crm-followup-compact-list {
  border-top:1px solid #dce5ee;
  display:grid;
}
.crm-followup-compact-row {
  align-items:center;
  border-bottom:1px solid #e3eaf1;
  color:#172b45;
  display:flex;
  gap:20px;
  justify-content:space-between;
  padding:16px 4px;
  text-decoration:none;
}
.crm-followup-compact-main,
.crm-followup-compact-meta {
  display:flex;
  flex-direction:column;
  gap:4px;
}
.crm-followup-compact-main small,
.crm-followup-compact-meta time,
.crm-followup-table small {
  color:#6b7d93;
}
.crm-followup-compact-meta {
  align-items:flex-end;
  flex:none;
}
.crm-followup-badge {
  background:#e7edf4;
  border-radius:999px;
  color:#445a72;
  display:inline-flex;
  font-size:.78rem;
  font-weight:850;
  padding:5px 9px;
  width:max-content;
}
.crm-followup-badge.is-overdue {
  background:#ffe0e0;
  color:#a12e2e;
}
.crm-followup-badge.is-today {
  background:#ffefbd;
  color:#815a00;
}
.crm-followup-badge.is-upcoming {
  background:#dff1ff;
  color:#175f91;
}
.crm-followup-empty {
  background:#f5f8fb;
  border:1px dashed #bdccda;
  border-radius:18px;
  color:#52677e;
  display:flex;
  flex-direction:column;
  gap:5px;
  padding:22px;
}
.crm-followup-page-hero {
  background:linear-gradient(135deg,#173f68 0%,#22689d 100%);
  color:#fff;
}
.crm-followup-page-hero h1,
.crm-followup-page-hero p,
.crm-followup-page-hero .eyebrow,
.crm-followup-page-hero .crm-back-link {
  color:#fff;
}
.crm-back-link {
  display:block;
  font-weight:800;
  margin-bottom:22px;
  text-decoration:none;
}
.crm-followup-page-stats {
  margin:28px 0;
}
.crm-followup-filter-form {
  align-items:end;
  display:grid;
  gap:16px;
  grid-template-columns:minmax(260px,2fr) minmax(210px,1fr) auto auto;
}
.crm-followup-filter-form label {
  color:#344a63;
  display:flex;
  flex-direction:column;
  font-weight:800;
  gap:7px;
}
.crm-followup-filter-form input,
.crm-followup-filter-form select {
  background:#fff;
  border:1px solid #bdcad8;
  border-radius:13px;
  color:#152942;
  font:inherit;
  min-height:48px;
  padding:10px 13px;
  width:100%;
}
.crm-followup-filter-form > a {
  align-items:center;
  color:#185d91;
  display:flex;
  font-weight:800;
  min-height:48px;
  text-decoration:none;
}
.crm-followup-table-wrap {
  overflow-x:auto;
}
.crm-followup-table {
  border-collapse:collapse;
  min-width:900px;
  width:100%;
}
.crm-followup-table th {
  color:#63758d;
  font-size:.8rem;
  letter-spacing:.03em;
  padding:12px 14px;
  text-align:left;
  text-transform:uppercase;
}
.crm-followup-table td {
  border-top:1px solid #e0e7ef;
  color:#243a54;
  padding:16px 14px;
  vertical-align:middle;
}
.crm-followup-table td:first-child {
  display:flex;
  flex-direction:column;
  gap:7px;
}
.crm-followup-table td:nth-child(2) {
  min-width:230px;
}
.crm-followup-table td:nth-child(2) strong,
.crm-followup-table td:nth-child(2) small {
  display:block;
}
.crm-followup-open-cell {
  text-align:right;
}
.crm-followup-page-empty {
  margin-top:20px;
}
@media (max-width:900px) {
  .crm-followup-stats {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .crm-followup-filter-form {
    grid-template-columns:1fr 1fr;
  }
}
@media (max-width:620px) {
  .crm-followup-panel,
  .crm-followup-filter-card,
  .crm-followup-results,
  .crm-followup-page-hero {
    border-radius:20px;
    padding:21px;
  }
  .crm-followup-heading,
  .crm-followup-result-heading,
  .crm-followup-compact-row {
    align-items:stretch;
    flex-direction:column;
  }
  .crm-followup-all-button {
    width:100%;
  }
  .crm-followup-stats,
  .crm-followup-filter-form {
    grid-template-columns:1fr;
  }
  .crm-followup-stat {
    min-height:90px;
  }
  .crm-followup-compact-meta {
    align-items:flex-start;
  }
  .crm-followup-table,
  .crm-followup-table tbody,
  .crm-followup-table tr,
  .crm-followup-table td {
    display:block;
    min-width:0;
    width:100%;
  }
  .crm-followup-table thead {
    display:none;
  }
  .crm-followup-table tr {
    border:1px solid #dce5ee;
    border-radius:17px;
    margin:14px 0;
    overflow:hidden;
  }
  .crm-followup-table td {
    border-top:1px solid #edf1f5;
    padding:13px 15px 13px 42%;
    position:relative;
  }
  .crm-followup-table td:first-child {
    border-top:0;
  }
  .crm-followup-table td::before {
    color:#65778d;
    content:attr(data-label);
    font-size:.75rem;
    font-weight:850;
    left:14px;
    position:absolute;
    text-transform:uppercase;
    top:15px;
    width:36%;
  }
  .crm-followup-open-cell {
    padding-left:15px !important;
    text-align:left;
  }
  .crm-followup-open-cell::before {
    display:none;
  }
  .crm-followup-open-cell a {
    width:100%;
  }
}
