:root {
  --akzent: #4f46e5; --akzent-dunkel: #4338ca;
  --text: #1f2333; --grau: #6b7280; --rand: #e3e6ef;
  --flaeche: #fff; --hintergrund: #f5f6fa; --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--hintergrund); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Kopf */
.kopf {
  display: flex; align-items: center; gap: 24px;
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
  padding: 12px 22px; position: sticky; top: 0; z-index: 10;
}
.marke { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.kopf nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.kopf nav a {
  padding: 6px 12px; border-radius: 7px; color: var(--grau); font-weight: 500;
}
.kopf nav a:hover { background: var(--hintergrund); text-decoration: none; }
.kopf nav a.aktiv { background: var(--akzent); color: #fff; }
.kopf-rechts { display: flex; align-items: center; gap: 12px; }
.benutzername { color: var(--grau); font-size: .88rem; }

main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
h1 { font-size: 1.5rem; margin: 0 0 20px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; }
.quelle { font-size: .75rem; color: var(--grau); font-weight: 400; }

/* Kacheln */
.kacheln {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.kachel {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; color: var(--text);
}
a.kachel:hover { border-color: var(--akzent); text-decoration: none; }
.kachel-zahl { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kachel-text { font-size: .82rem; color: var(--grau); }

/* Blöcke und Tabellen */
.block {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: 8px 10px; border-bottom: 1px solid var(--rand); text-align: left; }
.tabelle th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--grau); font-weight: 600; }
.tabelle tbody tr:last-child td { border-bottom: none; }
.tabelle .r { text-align: right; }
.leer, .klein { color: var(--grau); font-size: .88rem; margin: 0; }

/* Schaltflächen */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--rand);
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; font-size: .88rem;
}
.btn:hover { border-color: var(--akzent); text-decoration: none; }
.btn-primary { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.btn-primary:hover { background: var(--akzent-dunkel); }
.btn-klein { padding: 5px 11px; font-size: .82rem; }

/* Meldungen */
.meldung { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; font-size: .9rem; }
.fehler { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.hinweis { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* Anmeldung */
.login-seite { display: grid; place-items: center; min-height: 100vh; }
.login-karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
  padding: 30px 32px; width: min(370px, 92vw);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 8px 30px rgba(20, 25, 60, .07);
}
.login-karte h1 { margin: 0 0 4px; font-size: 1.25rem; text-align: center; }
.login-karte label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--grau); }
.login-karte input {
  padding: 9px 11px; border: 1px solid var(--rand); border-radius: 8px;
  font: inherit; color: var(--text);
}
.login-karte input:focus { outline: 2px solid var(--akzent); outline-offset: 1px; border-color: var(--akzent); }
.login-karte .btn { justify-content: center; margin-top: 4px; }

.fuss { text-align: center; color: var(--grau); font-size: .8rem; padding: 20px; }

/* --- Seitenkopf und Suche ------------------------------------------------- */
.seiten-kopf { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.seiten-kopf h1 { margin: 0; flex: 1; }
.anzahl {
  font-size: .8rem; font-weight: 600; color: var(--grau);
  background: var(--flaeche); border: 1px solid var(--rand);
  padding: 2px 9px; border-radius: 20px; vertical-align: middle; margin-left: 6px;
}
.suchleiste { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.suchleiste input[type=search], .suchleiste select {
  padding: 8px 11px; border: 1px solid var(--rand); border-radius: 8px; font: inherit; min-width: 200px;
}

/* --- Formulare ------------------------------------------------------------ */
.feldgitter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.feldgitter label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--grau); }
.feldgitter .breit2 { grid-column: span 2; }
.feldgitter .breit4 { grid-column: 1 / -1; }
.feldgitter input, .feldgitter select, .feldgitter textarea {
  padding: 8px 11px; border: 1px solid var(--rand); border-radius: 8px;
  font: inherit; color: var(--text); background: #fff; width: 100%;
}
.feldgitter input:focus, .feldgitter select:focus, .feldgitter textarea:focus {
  outline: 2px solid var(--akzent); outline-offset: 1px; border-color: var(--akzent);
}
.feldgitter textarea { resize: vertical; }
.aktionsleiste { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.btn-gefahr { background: #fee2e2; color: #991b1b; border-color: #fca5a5; margin-left: auto; }
.btn-gefahr:hover { background: #fecaca; border-color: #f87171; }

/* --- Marken und Zustände -------------------------------------------------- */
[class^="marke-"] {
  font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 12px;
  background: #eef0fb; color: #4338ca;
}
.marke-vermittler { background: #fef3c7; color: #92400e; }
.marke-endkunde   { background: #dbeafe; color: #1e40af; }
.marke-lieferant  { background: #f3e8ff; color: #6b21a8; }
.marke-sonstige   { background: #f1f5f9; color: #475569; }
.status-aktiv { color: #166534; font-weight: 600; font-size: .82rem; }
tr.gedimmt { opacity: .55; }
a.benutzername { color: var(--grau); }

@media (max-width: 760px) {
  .feldgitter { grid-template-columns: 1fr 1fr; }
  .feldgitter .breit2, .feldgitter .breit4 { grid-column: 1 / -1; }
}

/* --- Herkunft der Firmen -------------------------------------------------- */
.herkunft-kimai { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 12px;
                  background: #e0f2fe; color: #075985; white-space: nowrap; }
.herkunft-crm   { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 12px;
                  background: #f1f5f9; color: #475569; }
.info { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
input.gesperrt, .gesperrt { background: #f8fafc; color: var(--grau); cursor: not-allowed; }

/* --- Kanban --------------------------------------------------------------- */
.tafel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.spalte { background: #eef0f6; border: 1px solid var(--rand); border-radius: var(--radius); padding: 12px; }
.spalte h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em;
             color: var(--grau); margin: 0 0 10px; }
.karten { display: flex; flex-direction: column; gap: 9px; min-height: 90px; border-radius: 8px; }
.karten.ziel { outline: 2px dashed var(--akzent); outline-offset: 3px; }
.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-left: 3px solid #cbd5e1;
  border-radius: 8px; padding: 10px 12px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(20,25,60,.05);
}
.karte:hover { border-color: var(--akzent); }
.karte.zieht { opacity: .45; }
.karte.prio-high    { border-left-color: #dc2626; }
.karte.prio-ongoing { border-left-color: #0891b2; }
.karte.prio-medium  { border-left-color: #94a3b8; }
.karte.prio-low     { border-left-color: #cbd5e1; }
.karte-titel { font-weight: 600; font-size: .92rem; line-height: 1.35; }
.karte-text { color: var(--grau); font-size: .82rem; margin-top: 5px; }
.karte-fuss { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.chip { font-size: .72rem; background: #eef0fb; color: #4338ca; padding: 2px 8px; border-radius: 10px; }
.chip-person { background: #ecfdf5; color: #047857; }
.chip-spaet  { background: #fee2e2; color: #991b1b; font-weight: 600; }

/* --- Dialog --------------------------------------------------------------- */
.ueberlagerung {
  position: fixed; inset: 0; background: rgba(15,20,45,.45);
  display: grid; place-items: center; padding: 20px; z-index: 50;
}
.ueberlagerung[hidden] { display: none; }
.dialog-karte {
  background: var(--flaeche); border-radius: 14px; padding: 24px 26px;
  width: min(680px, 96vw); max-height: 92vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(15,20,45,.28);
}
.dialog-karte h2 { margin: 0 0 16px; font-size: 1.15rem; }
.dialog-karte .aktionsleiste { margin-top: 18px; }

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

/* --- Prioritäten ---------------------------------------------------------- */
.karte-kopf { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.prio { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
        padding: 1px 7px; border-radius: 4px; }
.prio-marke-high    { background: #fee2e2; color: #991b1b; }
.prio-marke-ongoing { background: #cffafe; color: #155e75; }
.prio-marke-medium  { background: #f1f5f9; color: #475569; }
.prio-marke-low     { background: #f8fafc; color: #94a3b8; }
.chip-projekt { background: #ede9fe; color: #5b21b6; font-weight: 600; }
.karte-kopf .chip { margin-left: auto; }

/* --- Kalender ------------------------------------------------------------- */
.monatsleiste { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.monatsleiste strong { font-size: 1.05rem; min-width: 170px; text-align: center; }
.kalender {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--rand); border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden;
}
.kal-wochentag { background: #eef0f6; padding: 7px 9px; font-size: .74rem; font-weight: 700;
                 text-transform: uppercase; letter-spacing: .05em; color: var(--grau); }
.kal-tag { background: var(--flaeche); min-height: 106px; padding: 5px 6px;
           display: flex; flex-direction: column; gap: 3px; }
.kal-tag.kal-fremd { background: #fafbfd; }
.kal-tag.kal-we    { background: #f7f8fc; }
.kal-tag.kal-heute { box-shadow: inset 0 0 0 2px var(--akzent); }
.kal-zahl { font-size: .78rem; font-weight: 600; color: var(--grau); }
.kal-heute .kal-zahl { color: var(--akzent); }
.kal-fremd .kal-zahl { opacity: .45; }
.kal-eintrag {
  font-size: .74rem; padding: 3px 6px; border-radius: 4px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.kal-eintrag:hover { filter: brightness(.94); }
.kal-eintrag.erledigt { text-decoration: line-through; opacity: .55; }
.ohne-datum { display: flex; flex-wrap: wrap; gap: 6px; }
.ohne-datum .kal-eintrag { white-space: normal; }

@media (max-width: 820px) { .kal-tag { min-height: 74px; } .monatsleiste strong { min-width: auto; } }

/* --- Zeiterfassung -------------------------------------------------------- */
.zeit-raster { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.tabelle-eng th, .tabelle-eng td { padding: 5px 8px; font-size: .85rem; }
@media (max-width: 900px) { .zeit-raster { grid-template-columns: 1fr; } }

/* --- Zeitzeilen ----------------------------------------------------------- */
.zeit-zeile { cursor: pointer; }
.zeit-zeile:hover { background: #f6f7fc; }
.zeit-zeile.gewaehlt { background: #eef0fb; box-shadow: inset 3px 0 0 var(--akzent); }
.zeit-zeile.exportiert { color: var(--grau); cursor: default; }
.zeit-zeile.exportiert:hover { background: transparent; }
.zeile-kimai { text-decoration: none; color: var(--grau); font-size: 1rem; padding: 0 4px; }
.zeile-kimai:hover { color: var(--akzent); text-decoration: none; }
.datei-symbol { margin-right: 6px; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: .85em; }

/* --- Neue Dokumente ------------------------------------------------------- */
.neu-leiste { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 14px;
              padding-bottom: 14px; border-bottom: 1px solid var(--rand); }
.neu-leiste input[type=text] { padding: 7px 10px; border: 1px solid var(--rand);
              border-radius: 8px; font: inherit; min-width: 190px; }
.chip-doku { background: #fef3c7; color: #92400e; font-weight: 600; text-decoration: none; }
.chip-doku:hover { background: #fde68a; text-decoration: none; }
.doku-verweis { font-size: .85rem; padding: 2px 0 6px; }

/* --- Umschalter aktiv/alle ------------------------------------------------ */
.schalter { display: inline-flex; border: 1px solid var(--rand); border-radius: 8px; overflow: hidden; }
.schalter a {
  padding: 8px 14px; font-size: .85rem; font-weight: 600; color: var(--grau);
  background: var(--flaeche); text-decoration: none; display: flex; align-items: center; gap: 6px;
}
.schalter a + a { border-left: 1px solid var(--rand); }
.schalter a:hover { background: var(--hintergrund); text-decoration: none; }
.schalter a.an { background: var(--akzent); color: #fff; }
.zaehler { font-size: .74rem; opacity: .75; font-weight: 500; }
.schalter a.an .zaehler { opacity: .9; }
.schalter-klein a { padding: 4px 9px; font-size: .76rem; }
.projekt-filter { float: right; font-weight: 400; display: flex; align-items: center; gap: 4px; }
.projekt-filter input { width: auto; margin: 0; }
.projekt-filter label { display: inline; color: var(--grau); cursor: pointer; }
.haken { flex-direction: row !important; align-items: center; gap: 7px !important; color: var(--text) !important; }
.haken input { width: auto !important; }
h3 { font-size: .95rem; margin: 0 0 12px; }
.anzahl-geld { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }

/* --- Notizen-Editor ------------------------------------------------------- */
.feld { display: flex; flex-direction: column; gap: 5px; }
.feld-beschriftung { font-size: .82rem; color: var(--grau); }
.editor-leiste { display: flex; gap: 3px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--rand); border-bottom: none; border-radius: 8px 8px 0 0;
  padding: 5px 7px; background: #fafbfd; }
.editor-leiste button { border: 1px solid transparent; background: none; cursor: pointer;
  padding: 3px 8px; border-radius: 5px; font: inherit; font-size: .82rem; color: var(--text); }
.editor-leiste button:hover { background: #eef0f6; border-color: var(--rand); }
.editor-leiste .trenner { width: 1px; height: 16px; background: var(--rand); margin: 0 3px; }
.editor { border: 1px solid var(--rand); border-radius: 0 0 8px 8px; padding: 9px 11px;
  min-height: 96px; max-height: 260px; overflow-y: auto; background: #fff; font: inherit; }
.editor:focus { outline: 2px solid var(--akzent); outline-offset: -1px; }
.editor:empty::before { content: attr(data-platzhalter); color: #b6bccd; }
.editor p { margin: 0 0 .5em; }
.editor ul, .editor ol { margin: 0 0 .5em; padding-left: 1.3em; }

/* --- Checkliste ----------------------------------------------------------- */
.checkliste { display: flex; flex-direction: column; gap: 5px; }
.check-zeile { display: flex; align-items: center; gap: 8px; }
.check-zeile input[type=text] { flex: 1; padding: 6px 9px; border: 1px solid var(--rand);
  border-radius: 7px; font: inherit; }
.check-zeile input[type=checkbox] { width: auto; margin: 0; flex: 0 0 auto; }
.check-zeile.erledigt input[type=text] { text-decoration: line-through; color: var(--grau);
  background: #fafbfd; }
.check-weg { border: none; background: none; color: #c3c8d6; cursor: pointer;
  font-size: .95rem; padding: 2px 5px; border-radius: 5px; }
.check-weg:hover { color: #c00; background: #fee2e2; }
.check-neu { display: flex; gap: 7px; margin-top: 7px; }
.check-neu input { flex: 1; padding: 7px 10px; border: 1px dashed var(--rand);
  border-radius: 7px; font: inherit; }

/* --- Checklistenstand auf der Karte --------------------------------------- */
.karte-check { display: flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: .74rem; color: var(--grau); font-weight: 600; }
.karte-check.vollstaendig { color: #047857; }
.check-symbol { font-size: .9rem; }
.check-balken { flex: 1; height: 4px; background: #e8ebf3; border-radius: 3px; overflow: hidden; }
.check-balken span { display: block; height: 100%; background: var(--akzent); border-radius: 3px; }
.karte-check.vollstaendig .check-balken span { background: #10b981; }
.login-logo { display: block; margin: 0 auto 4px; }
.marke { display: inline-flex; align-items: center; gap: 9px; }
.marke img { border-radius: 6px; }
.konto-punkt { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
input[type=color] { padding: 2px; height: 38px; cursor: pointer; }


/* ---- Mail ---------------------------------------------------------------- */
.mail-leiste { display:flex; flex-wrap:wrap; gap:1rem; align-items:center;
               justify-content:space-between; margin-bottom:1rem; }
.mail-leiste .suchleiste { display:flex; gap:.4rem; align-items:center; flex-wrap:wrap; }
.mail-leiste .haken { font-size:.85rem; color:var(--grau); display:flex; gap:.3rem; align-items:center; }
.schalter .zaehler { display:inline-block; margin-left:.35rem; padding:0 .35rem; border-radius:8px;
                     background:var(--akzent); color:#fff; font-size:.72rem; font-weight:600; }

.mail-raster { display:grid; grid-template-columns:minmax(280px, 380px) 1fr; gap:1rem;
               align-items:start; }
.mail-liste { padding:0; max-height:calc(100vh - 230px); overflow-y:auto; }
.mail-zeile { display:flex; gap:.6rem; padding:.7rem .8rem; border-bottom:1px solid var(--rand);
              text-decoration:none; color:inherit; }
.mail-zeile:hover { background:var(--hell); }
.mail-zeile.offen { background:var(--hell); box-shadow:inset 3px 0 0 var(--akzent); }
.mail-zeile.ungelesen .mail-betreff, .mail-zeile.ungelesen .mail-von { font-weight:600; }
.konto-punkt { width:9px; height:9px; border-radius:50%; flex:0 0 9px; margin-top:.4rem;
               display:inline-block; }
.mail-inhalt { min-width:0; flex:1; }
.mail-kopf { display:flex; justify-content:space-between; gap:.5rem; font-size:.85rem; }
.mail-von, .mail-betreff { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:block; }
.mail-datum { color:var(--grau); font-size:.78rem; white-space:nowrap; }
.mail-betreff { font-size:.9rem; margin-top:.1rem; }
.mail-fuss { display:flex; gap:.4rem; align-items:center; font-size:.78rem; color:var(--grau);
             margin-top:.2rem; }
.blaettern { display:flex; gap:.8rem; align-items:center; justify-content:center; padding:.8rem; }

.mail-ansicht { max-height:calc(100vh - 230px); overflow-y:auto; }
.mail-titel { font-size:1.15rem; margin:0 0 .6rem; }
.mail-meta { border-bottom:1px solid var(--rand); padding-bottom:.7rem; margin-bottom:.9rem;
             display:flex; flex-direction:column; gap:.15rem; }
.mail-bilder { font-size:.85rem; }
.mail-anhaenge { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.9rem; }
.mail-anhaenge .anhang { display:inline-flex; gap:.35rem; align-items:center; padding:.35rem .6rem;
                         border:1px solid var(--rand); border-radius:6px; font-size:.85rem;
                         text-decoration:none; color:inherit; background:var(--hell); }
.mail-anhaenge .anhang:hover { border-color:var(--akzent); }
.mail-koerper { line-height:1.55; overflow-x:auto; word-break:break-word; }
.mail-koerper img { max-width:100%; height:auto; }
.mail-koerper table { max-width:100%; }
.mail-koerper blockquote { border-left:3px solid var(--rand); margin:.6rem 0; padding-left:.8rem;
                           color:var(--grau); }
.mail-koerper pre { white-space:pre-wrap; font-family:inherit; margin:0; }

@media (max-width: 900px) {
  .mail-raster { grid-template-columns:1fr; }
  .mail-liste, .mail-ansicht { max-height:none; }
}

.mail-aktionen { display:flex; gap:.4rem; flex-wrap:wrap; margin:.8rem 0 1rem;
                 padding-bottom:.8rem; border-bottom:1px solid var(--rand); }

.editor-mail { min-height: 260px; }
.editor-mail .zitatkopf, .mail-koerper .zitatkopf { color: var(--grau); font-size: .88rem; }
