/* ═══════════════════════════════════════════════════════════════
   STEINFRESH CRM – Stylesheet
   Primärfarbe: Grasgrün #75b837 | Grau #6b7280
═══════════════════════════════════════════════════════════════ */

:root {
  --primary:        #75b837;
  --primary-light:  #f1f8e8;
  --primary-dark:   #5d9620;
  --gray:           #6b7280;
  --text:           #111827;
  --text-2:         #4b5563;
  --text-3:         #9ca3af;
  --border:         #e5e7eb;
  --bg:             #f3f4f6;
  --bg-2:           #f9fafb;
  --white:          #ffffff;
  --red:            #ef4444;
  --red-light:      #fef2f2;
  --success:        #16a34a;
  --yellow:         #f59e0b;
  --radius:         7px;
  --shadow:         0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:      0 12px 32px rgba(0,0,0,.14);
  --header-h:       56px;
  --toolbar-h:      48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border-radius: 20px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 600;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(93,158,42,.3); }
.btn-icon {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ghost {
  padding: 6px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: 13px;
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-delete {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--red); color: var(--red);
  background: none; font-size: 13px;
  transition: all .15s;
}
.btn-delete:hover { background: var(--red-light); }

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--white); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-logo { height: 30px; width: auto; }
.header-crm-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid var(--primary); border-radius: 4px;
  padding: 2px 6px;
}
.header-search-wrap {
  flex: 1; max-width: 420px; position: relative;
  display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 10px; color: var(--text-3); pointer-events: none;
}
.header-search {
  width: 100%; padding: 7px 32px 7px 32px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg); font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.header-search:focus {
  border-color: var(--primary); background: var(--white);
  box-shadow: 0 0 0 3px rgba(93,158,42,.12);
}
.search-clear {
  position: absolute; right: 8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-3); color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.search-clear:hover { background: var(--text-2); }
.header-right { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.sync-status { display: none; }

/* Quadratische Header-Buttons */
.hdr-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.hdr-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.hdr-btn--primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.hdr-btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.hdr-btn--active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── Report Panel ────────────────────────────────────────────── */
.report-panel {
  position: sticky; top: var(--header-h); z-index: 90;
  background: var(--white); border-bottom: 2px solid var(--primary);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  padding: 16px 24px;
}
.report-inner { max-width: 900px; margin: 0 auto; }
.report-month {
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--primary); margin-bottom: 12px;
}
.report-grid {
  display: flex; gap: 40px; flex-wrap: wrap;
}
.report-section { display: flex; flex-direction: column; gap: 6px; }
.report-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-3); margin-bottom: 2px;
}
.report-row { display: flex; align-items: baseline; gap: 10px; }
.report-num {
  font-size: 22px; font-weight: 700; color: var(--primary);
  min-width: 40px; text-align: right; line-height: 1;
}
.report-label { font-size: 13px; color: var(--text-2); }
.report-row--sub { opacity: .75; }
.report-num--sub { font-size: 16px; color: var(--text-2); }

/* ── Search Results ──────────────────────────────────────────── */
.search-results {
  position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 90; overflow-y: auto; padding: 20px;
}
.search-results-inner {
  max-width: 800px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}
.search-result-item {
  background: var(--white); border-radius: 10px; padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .15s;
  display: flex; align-items: flex-start; gap: 12px;
}
.search-result-item:hover { box-shadow: var(--shadow-md); }
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.search-result-title mark { background: #fef9c3; color: var(--text); border-radius: 2px; padding: 0 2px; }
.search-result-meta { font-size: 12px; color: var(--text-2); }
.search-result-badge {
  flex-shrink: 0; padding: 2px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.search-empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 14px; }

/* ── Kanban Toolbar ──────────────────────────────────────────── */
.kanban-toolbar {
  min-height: var(--toolbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px;
  background: var(--white); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tag-filter { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.tag-filter-btn {
  padding: 4px 12px; border-radius: 14px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--white); color: var(--text-2);
  white-space: nowrap; transition: all .15s; cursor: pointer;
}
.tag-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.tag-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Kanban Board ────────────────────────────────────────────── */
.kanban-board {
  display: flex; gap: 12px;
  padding: 16px;
  overflow-x: auto; align-items: flex-start;
  min-height: calc(100vh - var(--header-h) - var(--toolbar-h));
}
.kanban-col {
  flex: 0 0 256px; background: var(--bg-2);
  border-radius: 10px; display: flex; flex-direction: column;
}
.kanban-col-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid var(--border);
}
.kcol-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kcol-title { flex: 1; }
.kcol-sum { font-size: 11px; font-weight: 700; color: var(--success); white-space: nowrap; padding-right: 4px; }
.kcol-sum--sqm { color: var(--text-2); }
.kcol-count {
  background: var(--border); color: var(--text-2);
  border-radius: 10px; padding: 1px 7px; font-size: 11px; flex-shrink: 0;
}
.kanban-cards {
  padding: 8px; display: flex; flex-direction: column; gap: 8px;
  min-height: 80px;
}
.kanban-cards.drag-over { background: var(--primary-light); border-radius: 8px; }

/* ── Kanban Card ─────────────────────────────────────────────── */
.kcard {
  background: var(--white); border-radius: 10px; overflow: hidden;
  cursor: pointer; user-select: none;
  box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s;
}
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kcard.dragging { opacity: .5; transform: rotate(2deg); }
.kcard-hero { width: 100%; height: 110px; object-fit: cover; display: block; }
.kcard-body { padding: 10px; }
.kcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.kcard-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.kcard-sqm { font-size: 11px; font-weight: 700; color: var(--success); white-space: nowrap; flex-shrink: 0; }
.kcard-contact { font-size: 11px; color: var(--text-2); margin-bottom: 3px; }
.kcard-due { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.kcard-due.overdue { color: var(--red); font-weight: 600; }
.kcard-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.kcard-tag { padding: 2px 7px; border-radius: 8px; font-size: 10px; font-weight: 500; background: var(--primary-light); color: var(--primary); }
.kcard-footer {
  display: flex; gap: 8px; margin-top: 7px; padding-top: 7px;
  border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3);
}
.kcard-footer span { display: flex; align-items: center; gap: 3px; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: #fff; z-index: 9999; animation: toastIn .2s ease;
  pointer-events: none;
}
.toast.info    { background: var(--text-2); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--red); }
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── Project Modal ───────────────────────────────────────────── */
.pmodal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding-top: 32px; }
.pmodal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(3px); }
.pmodal-panel {
  position: relative; z-index: 1; background: var(--white); border-radius: 14px;
  width: 92%; max-width: 960px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: popIn .18s ease;
}
@keyframes popIn {
  from { transform: scale(.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);   opacity: 1; }
}
.pmodal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--white);
  border-radius: 14px 14px 0 0; z-index: 10; flex-shrink: 0;
}
.pmodal-status-badge {
  padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.pmodal-title-display { font-size: 18px; font-weight: 700; flex: 1; color: var(--text); }
.pmodal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: 14px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.pmodal-close:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.pmodal-body {
  display: grid; grid-template-columns: 1fr 360px;
  flex: 1; overflow: hidden;
}
.pmodal-left {
  padding: 20px 24px; border-right: 1px solid var(--border);
  overflow-y: auto; display: flex; flex-direction: column; gap: 0;
}
.pmodal-right {
  padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.pmodal-footer {
  padding: 12px 24px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Section titles */
.pmodal-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 6px;
}
.pmodal-left .pmodal-section-title { margin-top: 16px; }
.pmodal-left .pmodal-section-title:first-child { margin-top: 0; }
.pmodal-field { display: flex; flex-direction: column; gap: 6px; }
.pmodal-field .pmodal-section-title { margin: 0; }

/* ── Form inputs ─────────────────────────────────────────────── */
.p-input, .p-select, .p-textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: var(--white);
  outline: none; transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.p-input:focus, .p-select:focus, .p-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93,158,42,.12);
}
.p-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.p-select { cursor: pointer; }

/* ── Contact Fields ──────────────────────────────────────────── */
.contact-fields { display: flex; flex-direction: column; gap: 6px; }
.contact-field-row { display: flex; gap: 6px; }
.contact-field-row .p-input { flex: 1; }
.contact-input-row { display: flex; gap: 6px; align-items: center; }
.contact-input-row .p-input { flex: 1; }
.contact-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--primary-light); color: var(--primary);
  text-decoration: none; transition: background .15s, color .15s;
}
.contact-action:hover { background: var(--primary); color: #fff; }
.contact-action--hidden { display: none; }

/* ── Hero Image ──────────────────────────────────────────────── */
.hero-wrap { display: flex; flex-direction: column; gap: 6px; }
.hero-preview {
  width: 100%; height: 140px; object-fit: cover;
  border-radius: 8px; cursor: pointer; display: block;
  border: 2px solid var(--border); transition: border-color .15s;
}
.hero-preview:hover { border-color: var(--primary); }
.hero-placeholder {
  width: 100%; height: 100px; border: 2px dashed var(--border); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; color: var(--text-3); font-size: 12px;
  transition: all .15s;
}
.hero-placeholder:hover { border-color: var(--primary); color: var(--primary); }

/* ── Fläche inline ───────────────────────────────────────────── */
.sqm-inline-row { display: flex; align-items: center; gap: 10px; }
.sqm-inline-row .pmodal-section-title { margin: 0; white-space: nowrap; flex-shrink: 0; }
.sqm-inline-input { width: 90px !important; flex-shrink: 0; }
.sqm-manual-input { width: 110px !important; flex-shrink: 0; }
.sqm-price { font-size: 12px; color: var(--success); font-weight: 600; min-height: 16px; }
.sqm-discount { font-size: 12px; color: var(--yellow); font-weight: 600; min-height: 14px; }

/* ── Drop-Indikator (Innerhalb-Sortierung) ───────────────────── */
.drop-indicator {
  height: 3px; background: var(--primary); border-radius: 2px;
  margin: 2px 4px; pointer-events: none;
}

/* ── Termin ──────────────────────────────────────────────────── */
.due-row { display: flex; gap: 8px; }
.due-row .p-input { flex: 1.4; }
.due-row .p-select { flex: 1; }

/* ── Kundenordner ────────────────────────────────────────────── */
.folder-row { display: flex; gap: 6px; align-items: center; }
.folder-row .p-input { flex: 1; }
.folder-open-btn {
  padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  white-space: nowrap; text-decoration: none; flex-shrink: 0;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
  display: inline-flex; align-items: center; transition: background .15s;
}
.folder-open-btn:hover { background: #dbeafe; }
.folder-open-btn { cursor: pointer; }

/* ── Tags ────────────────────────────────────────────────────── */
.ptag-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.ptag {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: 12px; user-select: none; transition: all .12s;
}
.ptag:hover { cursor: pointer; }

/* ── Tasks ───────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 4px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; transition: background .12s; }
.task-item:hover { background: var(--bg); }
.task-item input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.task-text { flex: 1; font-size: 14px; border: none; outline: none; background: transparent; }
.task-text.done { text-decoration: line-through; color: var(--text-3); }
.task-item-del { width: 20px; height: 20px; border-radius: 50%; font-size: 12px; color: var(--text-3); display: flex; align-items: center; justify-content: center; transition: all .12s; flex-shrink: 0; }
.task-item-del:hover { background: var(--red-light); color: var(--red); }
.task-add-input { width: 100%; padding: 7px 10px; border: 1px dashed var(--border); border-radius: 6px; font-size: 14px; outline: none; background: transparent; margin-top: 4px; }
.task-add-input:focus { border-color: var(--primary); background: var(--white); box-sizing: border-box; }

/* ── Comments ────────────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.comment-item { padding: 8px 12px; background: var(--bg); border-radius: 8px; }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.comment-date { font-size: 11px; color: var(--text-3); }
.comment-edit-btn {
  font-size: 13px; color: var(--text-3); background: none; border: none;
  cursor: pointer; padding: 0 2px; line-height: 1; opacity: 0; transition: opacity .15s, color .15s;
}
.comment-item:hover .comment-edit-btn { opacity: 1; }
.comment-edit-btn:hover { color: var(--primary); }
.comment-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.comment-edit-area {
  width: 100%; padding: 7px 10px; margin-top: 6px;
  border: 1px solid var(--primary); border-radius: 6px;
  font-size: 14px; line-height: 1.5; resize: vertical; outline: none;
  min-height: 60px; box-sizing: border-box;
  box-shadow: 0 0 0 3px rgba(93,158,42,.12);
}
.comment-edit-actions { display: flex; gap: 6px; margin-top: 6px; }
.comment-save-btn {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--primary); color: #fff; border: none; cursor: pointer; transition: opacity .15s;
}
.comment-save-btn:hover { opacity: .85; }
.comment-delete-btn {
  padding: 5px 10px; border-radius: 6px; font-size: 12px;
  background: none; border: 1px solid var(--border); color: var(--text-3);
  cursor: pointer; transition: all .15s;
}
.comment-delete-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .pmodal { padding-top: 0; align-items: flex-end; }
  .pmodal-panel { width: 100%; max-width: 100%; max-height: 94vh; border-radius: 14px 14px 0 0; }
  .pmodal-body { grid-template-columns: 1fr; }
  .pmodal-left { border-right: none; border-bottom: 1px solid var(--border); }
  .header-brand { display: none; }
  .kanban-col { flex: 0 0 220px; }

  /* Header */
  .app-header { gap: 8px; padding: 0 10px; }
  .header-search-wrap { flex: 1; max-width: none; }
}
@media (max-width: 900px) {
  .pmodal-body { grid-template-columns: 1fr; }
  .pmodal-left { border-right: none; border-bottom: 1px solid var(--border); max-height: 60vh; }
}

.hidden { display: none !important; }

/* ── Login ───────────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #f1f8e8 0%, #e8f5d4 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff; border-radius: 20px;
  box-shadow: 0 8px 40px rgba(117,184,55,.15), 0 2px 8px rgba(0,0,0,.08);
  padding: 48px 40px 40px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.login-logo { height: 52px; margin-bottom: 4px; }
.login-title {
  font-size: 13px; font-weight: 700; letter-spacing: 3px;
  color: var(--text-3); text-transform: uppercase; margin-bottom: 24px;
}
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-input {
  width: 100%; padding: 12px 16px; border-radius: 10px;
  border: 1.5px solid var(--border); font-size: 16px;
  outline: none; transition: border-color .15s;
  box-sizing: border-box;
}
.login-input:focus { border-color: var(--primary); }
.login-btn {
  width: 100%; padding: 13px; border-radius: 10px;
  background: var(--primary); color: #fff;
  border: none; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.login-btn:hover { background: var(--primary-dark); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-error {
  font-size: 13px; color: #dc2626; text-align: center;
  background: #fef2f2; border-radius: 8px; padding: 8px;
}
