:root {
  /* Markenfarbe FIFTYSEVEN Real Estate: #1D3C34 (Tannengrün) */
  --brand: #1d3c34;
  --brand-700: #142b25;   /* dunkler für Hover */
  --brand-50: #eaf1ee;    /* heller Grün-Ton für Flächen/Hover */
  --accent: #3e7c68;      /* dezentes Mittelgrün für Akzente */
  --green: #2e7d5b;
  --red: #b3352f;
  --amber: #b7791f;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e4e8ee;
  --text: #1e2733;
  --muted: #6b7787;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20,40,34,.06), 0 6px 20px rgba(20,40,34,.05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--brand); cursor: pointer; text-decoration: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand) 0%, #0c1f1a 100%); padding: 20px; }
.login-card { background: var(--card); padding: 36px 32px; border-radius: 16px;
  width: 360px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center; }
.login-card h1 { font-size: 20px; margin: 8px 0 2px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 16px;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 28px; letter-spacing: 1px; }
.login-logo-img { width: 220px; max-width: 80%; height: auto; margin: 4px auto 0; display: block; }
.login-card label { display: block; text-align: left; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.login-card input { margin-top: 4px; }
.form-error { color: var(--red); margin-top: 12px; font-size: 13px; min-height: 18px; }

/* ---------- Layout ---------- */
#app-view { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #cdd8e5; display: flex; flex-direction: column; padding: 18px 12px;
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 10px 8px 18px; }
.brand-logo { width: 100%; max-width: 168px; height: auto; display: block; }
.brand-badge { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--brand);
  font-weight: 800; display: grid; place-items: center; font-size: 15px; }
.brand-text { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.15; }
.sb-search { position: relative; margin: 2px 6px 10px; }
.sb-search input { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); color: #fff; padding: 8px 10px; font-size: 13px; }
.sb-search input::placeholder { color: #9fb2c6; }
.sb-search input:focus { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); box-shadow: none; }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.3); z-index: 40; overflow: hidden; max-height: 60vh; overflow-y: auto; }
.search-results .sr { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results .sr:hover { background: var(--brand-50); }
.search-results .sr .t { font-size: 13px; font-weight: 600; color: var(--text); }
.search-results .sr .s { font-size: 11.5px; color: var(--muted); }
.search-results .sr .tag { float: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.search-results .none { padding: 12px; color: var(--muted); font-size: 13px; }
#nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 8px 0 0; }
.timeline li { position: relative; padding: 0 0 12px 20px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline .ti-t { font-size: 13.5px; }
.timeline .ti-m { font-size: 11.5px; color: var(--muted); }
.quicknote { display: flex; gap: 8px; margin: 6px 0 4px; }
.quicknote input { flex: 1; }
/* Charts */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 8px 4px 0; }
.chart-bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bars .bar-fill { width: 70%; background: var(--brand); border-radius: 5px 5px 0 0; min-height: 2px; transition: height .3s; }
.chart-bars .bar-lbl { font-size: 10.5px; color: var(--muted); margin-top: 5px; text-align: center; }
.chart-bars .bar-val { font-size: 11px; font-weight: 600; margin-bottom: 3px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--brand); }
.notice { background: var(--brand-50); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.notice-warn { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.chk-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.chk-line input { width: auto; }
.lnk { color: var(--brand); cursor: pointer; font-weight: 600; }
.lnk:hover { text-decoration: underline; }
.nav-item { color: #cdd8e5; padding: 10px 12px; border-radius: 9px; font-size: 14px; user-select: none; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.user-box { font-size: 13px; color: #fff; margin-bottom: 8px; padding: 0 6px; }
.user-box small { color: #9fb2c6; display: block; }

.main { padding: 26px 30px; overflow-x: hidden; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons & inputs ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 500; }
.btn:hover { border-color: #c9d2dd; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { color: var(--red); border-color: #e6c4c2; }
.btn-danger:hover { background: #fbecec; }
.btn-block { width: 100%; margin-top: 18px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.icon-btn { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--brand-50); color: var(--text); }

input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,60,52,.12); }
textarea { resize: vertical; min-height: 70px; }
.search-input { width: 240px; }

/* ---------- Cards / KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi .value.small { font-size: 20px; }
.kpi.warn .value { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.card-body { padding: 8px 18px 16px; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--brand-50); cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.grp-head td { background: var(--brand-50); cursor: pointer; color: var(--brand); position: sticky; }
tr.grp-head:hover td { background: #dfeae6; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-gf-investment { background: #fff4e0; color: #8a6114; }
.badge-gf-transaktion { background: #e5eefb; color: #234a86; }
.badge-grey { background: #eef1f5; color: #55606d; }
.badge-green { background: #e3f2ea; color: var(--green); }
.badge-red { background: #fbe9e8; color: var(--red); }
.badge-amber { background: #fbf1dd; color: var(--amber); }
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }

/* ---------- Pipeline / Kanban ---------- */
.pipeline-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.board-col { flex: 0 0 260px; background: #eef1f5; border-radius: var(--radius); padding: 10px; }
.board-col.dragover { outline: 2px dashed var(--brand); background: #dfeae6; }
.board-col-head { font-size: 12.5px; font-weight: 600; color: #44515f; padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.board-col-head .sum { color: var(--muted); font-weight: 500; }
.deal-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin-bottom: 9px; cursor: grab; box-shadow: 0 1px 2px rgba(16,32,53,.05); }
.deal-card:active { cursor: grabbing; }
.deal-card .t { font-weight: 600; font-size: 13.5px; }
.deal-card .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.deal-card .val { font-weight: 600; font-size: 13px; margin-top: 6px; }

/* ---------- Forms in modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,25,40,.5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 640px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label, .form-full { display: block; font-size: 12.5px; color: var(--muted); }
.form-full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { margin-top: 4px; }
.form-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-section { margin-top: 18px; }
.detail-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; display:flex; justify-content:space-between; gap:8px;}
.mini-list li:last-child { border-bottom: none; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13.5px; z-index: 100; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }

.chk { display:flex; align-items:center; gap:8px; }
.chk input { width:auto; }
.row-actions { display:flex; gap:6px; }
.bar { height: 7px; border-radius: 4px; background: #e6ebf1; overflow: hidden; margin-top: 8px; }
.bar > span { display:block; height:100%; background: var(--brand); }

@media (max-width: 820px) {
  #app-view { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; flex-wrap: wrap;
    position: sticky; top: 0; height: auto; overflow: visible; z-index: 30; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; display:flex; gap:8px; align-items:center;}
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
