/*
 * WACH CRM – CI wie im Passwort-Tool:
 * Farbwelt WACH: Coquelicot (#fa4517), Weiß, Schwarz.
 * Alle Grautöne sind Schwarz mit reduzierter Deckkraft, alle Signalfarben
 * Abstufungen des Orange - es kommt kein vierter Farbton dazu.
 */
:root {
  --brand: #fa4517;
  --brand-deep: #c2380f;

  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #ededed;
  --border: #dedede;
  --text: #000000;
  --muted: #666666;

  --accent: #fa4517;
  --accent-soft: #ffe9e2;
  --on-accent: #ffffff;

  --danger: #d63b10;
  --danger-soft: #ffe4db;
  --warn: #a8300d;
  --warn-soft: #fff1ec;

  /* "Erledigt"/Gewonnen ist bewusst neutral: Grün gibt es in dieser Palette nicht. */
  --ok: #1a1a1a;
  --ok-soft: #ebebeb;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --surface: #161616;
    --surface-2: #212121;
    --border: #2e2e2e;
    --text: #f2f2f2;
    --muted: #9b9b9b;

    --accent: #ff5c30;
    --accent-soft: #3a1a10;
    --on-accent: #ffffff;

    --danger: #ff6f45;
    --danger-soft: #3a1a10;
    --warn: #ff8a5c;
    --warn-soft: #2e1710;

    --ok: #e8e8e8;
    --ok-soft: #232323;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- Sidebar */

header#app-header {
  position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 20;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 2px 8px 20px; }
.brand-logo { height: 26px; width: auto; max-width: 100%; display: block; }
/* Das Logo ist einfarbig; im Dunkelmodus wird das Schwarz zu Weiß gedreht. */
@media (prefers-color-scheme: dark) {
  .brand-logo { filter: invert(1) hue-rotate(180deg); }
}
.logo-sub { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0.02em; }
.logo span[aria-hidden] { color: var(--muted); font-weight: 400; }

nav { display: flex; flex-direction: column; gap: 4px; }
nav button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; width: 100%;
  color: var(--muted); font: inherit; font-weight: 500; text-align: left;
  cursor: pointer;
}
nav button:hover { background: var(--surface-2); color: var(--text); }
nav button.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
nav button.active:hover { background: var(--brand-deep); color: var(--on-accent); }

#user-info {
  margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 600;
}
#user-info button {
  font: inherit; font-size: 12px; font-weight: 550; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
#user-info button:hover { background: var(--surface-2); color: var(--text); }

#integrations { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- Inhalt */

main { margin-left: 232px; padding: 26px 30px 60px; max-width: 1180px; }
.tab { display: none; }
.tab.active { display: block; }

/* ---------------------------------------------------------------- Bausteine */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.on { background: var(--accent-soft); color: var(--accent); }
.tag {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
/* Tags bewusst alle neutral grau – Farbe bleibt den Status-Pills rechts vorbehalten */
.tag.awork { background: var(--surface-2); color: var(--muted); }
#deals-table .tag { background: var(--surface-2); color: var(--muted); }
#deals-table .tag.awork { background: var(--surface-2); color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12px; font-weight: 600; }

/* Einheitliche Projektnummer auf der Detailseite */
.pn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pn-row code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px;
}

/* KPI-Kacheln: Beschriftung oben, Wert darunter (wie im Passwort-Tool) */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column-reverse; justify-content: flex-end;
}
.kpi .value {
  font-size: 27px; font-weight: 680; letter-spacing: -0.02em; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.panel h2 { font-size: 17px; margin-bottom: 12px; display: block; }
.panel p { color: var(--muted); }
.panel table { border: 0; }

/* ---------------------------------------------------------------- Diagramm */

.chart { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding-top: 6px; }
.chart .bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%; max-width: 46px; background: var(--surface-2); border-radius: 6px 6px 3px 3px;
  position: relative; min-height: 3px; overflow: hidden;
}
.chart .bar .won { position: absolute; bottom: 0; left: 0; right: 0; background: var(--accent); }
.chart .month { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart .count { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Formulare */

.row-form { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
input, select, textarea {
  font: inherit; color: var(--text);
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
}
/* Dropdowns überall genauso hoch wie die Textfelder (kompakte Status-Pills in den Karten ausgenommen) */
input:not([type="checkbox"]):not([type="radio"]), select:not(.status-select):not(.art-select) {
  height: 40px; box-sizing: border-box;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 72px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
.row-form input[name="title"], .row-form input[name="name"] { flex: 1; min-width: 200px; }

button { font: inherit; }
.row-form button[type="submit"], button[type="submit"], .btn-sm.primary {
  font-weight: 600; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.row-form button[type="submit"]:hover:not(:disabled), button[type="submit"]:hover:not(:disabled),
.btn-sm.primary:hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  font: inherit; font-weight: 550; font-size: 13px;
  padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.btn-sm:hover:not(:disabled) { background: var(--surface-2); }
.btn-sm.primary { font-size: 13px; padding: 5px 11px; }

button.danger, td button.danger {
  color: var(--danger); border: 1px solid var(--danger); background: transparent;
}
button.danger:hover:not(:disabled), td button.danger:hover:not(:disabled) { background: var(--danger-soft); }

/* ---------------------------------------------------------------- Tabellen */

table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 650; padding: 10px 10px 8px; border-bottom: 1px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td a { color: inherit; text-decoration: none; font-weight: 600; }
td a:hover { color: var(--accent); }
td button {
  font: inherit; font-weight: 550; font-size: 12.5px;
  padding: 4px 9px; border-radius: 8px; margin-right: 4px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
td button:hover:not(:disabled) { background: var(--surface-2); }

/* ------------------------------------------------- Formular-Raster + Suche */

.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  align-items: end;
}
.form-grid label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; gap: 5px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .form-actions { display: flex; }
.inline-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}

/* Firmen-Suche mit Vorschlagsliste */
.ac { position: relative; display: block; }
.ac input:not([type="hidden"]) { width: 100%; }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; max-height: 280px; overflow-y: auto;
}
.ac-list[hidden] { display: none; }
.ac-list button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: none; border: 0; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.ac-list button:hover { background: var(--accent-soft); color: var(--accent); }

/* Ansprechpartner-Auswahl als Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 12.5px; font-weight: 550;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--accent); }
.chip.sel { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .chip-role { font-weight: 400; font-size: 11px; opacity: 0.75; }
.chip-add { border-style: dashed; color: var(--muted); }

/* --------------------------------------------------- Anfrage-Unterseite */

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.deal-title { font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.deal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .deal-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------- Kontakte-Detail */

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tr.contact-row { cursor: pointer; }
tr.contact-row.open td { border-bottom: 0; background: var(--surface-2); }
tr.detail-row td { background: var(--surface-2); padding: 4px 14px 16px; cursor: default; }
tr.detail-row:hover { background: transparent; }

.contact-detail {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.contact-detail h4 {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin-bottom: 10px;
}
.person-card {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
  font-size: 13.5px;
}
.person-card span { white-space: nowrap; }
.person-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--border);
}
.person-form button { grid-column: 1 / -1; justify-self: start; }
.contact-form-detail { display: flex; flex-direction: column; gap: 10px; }
.contact-form-detail label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
}
.contact-form-detail label .muted { font-weight: 400; }

@media (max-width: 900px) {
  .contact-detail { grid-template-columns: 1fr; }
  .person-form { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- Status */
/* Achtung/Alarm/Erledigt nur über Orange-Abstufungen und Neutraltöne - kein Grün. */

.status-select {
  padding: 4px 8px; border-radius: 999px; border: 1px solid transparent;
  font-size: 12px; font-weight: 650; cursor: pointer; text-align: center;
  appearance: none; -webkit-appearance: none;
}
.status-select.status-offen { background: var(--surface-2); color: var(--text); }
.status-select.status-gewonnen { background: var(--ok); color: var(--surface); }
.status-select.status-verloren { background: var(--danger-soft); color: var(--danger); }
.status-select.status-verschoben { background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------- Anfragen-Kartenzeilen */

#deals-list { display: flex; flex-direction: column; gap: 10px; }
.deal-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; cursor: pointer;
}
.deal-card:hover { border-color: #c9c6c1; box-shadow: var(--shadow); }
.deal-card .avatar-ic.lg { width: 40px; height: 40px; border-radius: 10px; margin-right: 0; flex: 0 0 auto; }
.deal-card-main { flex: 1; min-width: 0; }
.deal-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 650; font-size: 15px; }
.deal-card-meta { margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-card-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.deal-card-value { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.deal-card input[type="checkbox"] { flex: 0 0 auto; }
@media (max-width: 700px) {
  .deal-card { flex-wrap: wrap; }
  .deal-card-right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
}

/* Umschalter KI / Manuell */
.seg-toggle {
  display: inline-flex; gap: 3px; background: var(--surface-2); border-radius: 9px; padding: 3px;
}
.seg-btn {
  font: inherit; font-size: 13px; font-weight: 550; color: var(--muted);
  border: 0; background: transparent; border-radius: 7px; padding: 6px 14px; cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* ------------------------------------------------------- Kunden-Icons */

.avatar-ic {
  width: 26px; height: 26px; border-radius: 7px; object-fit: cover;
  vertical-align: middle; margin-right: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
}
td input[type="checkbox"] { width: auto; min-height: auto; accent-color: var(--accent); cursor: pointer; }

/* ---------------------------------------------------------------- Warnungen */

.warning-box {
  border-radius: 8px; padding: 11px 13px; font-size: 13px;
  background: var(--warn-soft); color: var(--warn); border: 0;
  margin-bottom: 14px;
}
.warning-box summary { cursor: pointer; font-weight: 650; user-select: none; }
.warning-box ul { margin: 10px 0 2px 18px; display: flex; flex-direction: column; gap: 6px; }
.hint-link {
  background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 650;
  color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

/* ---------------------------------------------------------------- Login (Gate) */

#login-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: grid; place-items: center; padding: 24px;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 30px; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 11px;
}
.login-box .logo { padding: 0 0 10px; }
.login-box .brand-logo { height: 24px; }
.login-box input { padding: 10px 12px; }
.login-box button {
  font: inherit; font-weight: 600; padding: 10px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.login-box button:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
#login-error { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; }

/* ---------------------------------------------------------------- Dialog */

#modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(16, 20, 28, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
  backdrop-filter: blur(2px);
}
#deal-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  width: 100%; max-width: 620px; padding: 20px;
}
#deal-modal h2 { font-size: 17px; margin-bottom: 16px; }
#deal-modal h3 {
  font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em;
  margin: 20px 0 8px; color: var(--muted);
}
#modal-form { display: flex; flex-direction: column; gap: 12px; }
#modal-form label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal-actions button {
  font: inherit; font-weight: 550; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.modal-actions button:hover:not(:disabled) { background: var(--surface-2); }
.modal-actions button[type="submit"] {
  font-weight: 600; border-color: var(--accent); background: var(--accent); color: var(--on-accent);
}
.modal-actions button[type="submit"]:hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }

.voucher-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 2px; font-size: 13px; border-bottom: 1px solid var(--border);
}
.voucher-item:last-child { border-bottom: 0; }
.voucher-item button {
  font: inherit; font-weight: 550; font-size: 11.5px; padding: 3px 8px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; margin-left: 4px;
}
.voucher-item button:hover { background: var(--surface-2); }

.note-item {
  border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.note-item .note-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------------------- Sonstiges */

#intake-info {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 13px; font-size: 12px; line-height: 1.6; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
#list-summary, #lex-import-status { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- Mobil */

@media (max-width: 900px) {
  header#app-header {
    position: sticky; top: 0; inset: auto; width: auto; height: auto; z-index: 20;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px; padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .logo { padding: 0; }
  .brand-logo { height: 22px; }
  nav {
    order: 2; flex-direction: row; flex-wrap: nowrap; width: 100%; gap: 4px;
    margin: 4px -14px 0; padding: 0 14px 2px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  nav::-webkit-scrollbar { display: none; }
  nav button { width: auto; flex: 0 0 auto; white-space: nowrap; padding: 9px 12px; min-height: 40px; }
  #user-info { order: 1; margin: 0 0 0 auto; padding: 0; border: 0; }

  main { margin-left: 0; padding: 16px 14px 48px; }
  .two-col { grid-template-columns: 1fr; }
  button, .btn-sm { min-height: 40px; }
  /* iOS zoomt bei Feldern mit kleinerer Schrift automatisch hinein. */
  input, select, textarea { font-size: 16px; min-height: 42px; }

  #modal-backdrop { padding: 0; align-items: stretch; }
  #deal-modal { max-width: none; min-height: 100%; border-radius: 0; border: 0; padding: 16px 14px 24px; }

  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 22px; }

  /* Breite Tabellen scrollen im eigenen Rahmen, statt die Seite zu sprengen. */
  section.tab { overflow-x: auto; }
}

/* Querverlinkungen: dezente Links, die erst beim Hover als Link erkennbar werden */
a.link-quiet {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  cursor: pointer;
}
a.link-quiet:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* Klickbare Tabellenzeilen (z. B. Dashboard: Anfragen nach Quelle) */
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--surface-2); }

/* ---------------------------------------------------------------- Dashboard */

.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.dash-title { font-size: 22px; }
.kpi .note { font-size: 12px; color: var(--muted); }
.kpi .note b { color: var(--text); font-weight: 600; }
.kpi .value { margin-bottom: 4px; }
.kpi-klick { cursor: pointer; }
.kpi-klick:hover { border-color: var(--accent); }

.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chart-head h2 { margin: 0; }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .dot-won { background: var(--accent); }
.legend .dot-all { background: var(--surface-2); }
.jahr-chip { font-weight: 650; letter-spacing: 0.06em; padding-left: 14px; border-left: 1px solid var(--border); }
.chart-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
/* Balken dürfen nicht vom Flex-Layout gestaucht werden, sonst stimmt die Höhe nicht */
.chart .bar { flex: none; }
.chart .bar.leer { background: none; border: 1px dashed var(--border); }
.chart .bar-group[data-zeit] { cursor: pointer; }
.chart .bar-group[data-zeit]:hover .bar { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart .bar-group.aus .count, .chart .bar-group.aus .month { opacity: 0.4; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-name { flex: 0 0 132px; font-weight: 550; font-size: 14px; }
.track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.track span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.list-num { flex: 0 0 104px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.list-num b { color: var(--text); font-weight: 650; }
.list-row.row-link { cursor: pointer; }
.list-row.row-link:hover .list-name { color: var(--accent); }

.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 14px 0 12px; }
.split .a { background: var(--accent); }
.facts { display: flex; gap: 28px; flex-wrap: wrap; }
.fact .v { font-size: 17px; font-weight: 680; font-variant-numeric: tabular-nums; }
.fact .k { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .dash-cols { grid-template-columns: 1fr; }
  .dash-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Anmeldung mit Google */
.login-trenner { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; }
.login-trenner::before, .login-trenner::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 40px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-weight: 550; text-decoration: none;
}
.google-btn:hover { background: var(--surface-2); }

/* E-Mail-Verläufe an einer Anfrage */
.mail-item { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; overflow: hidden; }
.mail-kopf { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; cursor: pointer; }
.mail-kopf:hover { background: var(--surface-2); }
.mail-kopf .betreff { font-weight: 600; font-size: 14px; }
.mail-kopf .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mail-kopf .rechts { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mail-body { border-top: 1px solid var(--border); padding: 4px 12px 12px; }
.mail-nachricht { padding: 10px 0; border-bottom: 1px solid var(--border); }
.mail-nachricht:last-child { border-bottom: 0; }
.mail-nachricht .von { font-size: 12px; font-weight: 600; }
.mail-nachricht .datum { font-size: 12px; color: var(--muted); font-weight: 400; }
.mail-nachricht pre {
  font: inherit; font-size: 13px; white-space: pre-wrap; word-break: break-word;
  margin-top: 6px; color: var(--text);
}

/* Felder nebeneinander enden immer auf derselben Höhe – auch wenn eine
   Beschriftung umbricht. Hinweise stehen als eigene Zeile unter der Reihe. */
.two-col > label { justify-content: flex-end; }
.feld-notiz {
  display: block; font-size: 12px; color: var(--muted);
  margin: -6px 0 12px;
}
.feld-notiz:empty { display: none; }
/* Beschreibungsfeld wächst mit dem Inhalt */
#modal-form textarea[name="description"] { overflow: hidden; min-height: 66px; }

/* Angebotsart je verknüpftem Angebot */
.art-select {
  font: inherit; font-size: 11.5px; font-weight: 550;
  height: 26px; padding: 0 6px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  margin-left: 4px; cursor: pointer;
}
.art-select:hover { color: var(--text); }
