/* =============================================================
   APP.CSS — Shared Styles · OOTB Buchhaltung
   ============================================================= */

:root {
  --bg:         #F7F4EF;
  --white:      #FFFFFF;
  --text:       #1A1A1A;
  --muted:      #767676;
  --light:      #B0A89A;
  --border:     #E4DDD4;
  --border-lt:  #EDE7DF;
  --accent:     #C4622D;
  --acc-hover:  #A84E22;
  --pos:        #2E7D4F;
  --neg:        #B83232;
  --warn:       #C48A10;
  --header-h:   52px;
  --nav-h:      42px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── HEADER ──────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 200;
}

.logo-bold   { font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
.logo-italic { font-size: 15px; font-weight: 300; font-style: italic; color: var(--muted); }

.header-right { display: flex; align-items: center; gap: 18px; }

.header-konto {
  font-size: 12.5px;
  color: var(--muted);
}
.header-konto strong { color: var(--text); font-weight: 600; }

.period-pills {
  display: flex;
  background: #EEEAE4;
  border-radius: 7px;
  padding: 3px;
  gap: 2px;
}
.period-pills button {
  padding: 4px 11px;
  border: none; background: transparent;
  border-radius: 5px;
  font-size: 12px; font-weight: 500;
  color: var(--muted);
  cursor: pointer; transition: all 0.12s;
  font-family: inherit;
}
.period-pills button.active { background: var(--text); color: #fff; }

.btn-erfassen {
  background: var(--accent); color: white;
  border: none; padding: 7px 16px;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
  font-family: inherit;
}
.btn-erfassen:hover { background: var(--acc-hover); }

/* ── NAV ─────────────────────────────────────────────────── */
.app-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 20px;
  position: sticky; top: var(--header-h); z-index: 190;
}
.app-nav a {
  display: block;
  padding: 11px 12px 9px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.12s;
  white-space: nowrap;
}
.app-nav a:hover  { color: var(--text); }
.app-nav a.nav-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── PAGE LAYOUT ─────────────────────────────────────────── */
.page-wrap  { padding: 28px 28px 60px; max-width: 1320px; }

.page-crumb { font-size: 10.5px; color: var(--light); text-transform: uppercase; letter-spacing: 0.9px; margin-bottom: 3px; }
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; margin-bottom: 2px; }
.page-sub   { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

/* ── KPI CARDS ───────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px; }

.kpi { background: var(--white); border: 1px solid var(--border); border-radius: 9px; padding: 18px 20px; }
.kpi.warm  { background: #FDF5EF; border-color: #E8C9AD; }
.kpi.green { background: #F2F7F4; border-color: #B9D4C3; }

.kpi-lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; font-weight: 600; margin-bottom: 9px; }
.kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 7px; }
.kpi-bar { height: 3px; background: #E4DDD4; border-radius: 2px; overflow: hidden; margin-bottom: 7px; }
.kpi-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); }
.kpi-bar-fill.g { background: var(--pos); }
.kpi-meta { font-size: 12px; color: var(--muted); }
.kpi-meta .neg { color: var(--neg); }
.kpi-meta .pos { color: var(--pos); }

/* ── CARDS ───────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 9px; padding: 22px 24px; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.card-sub   { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

/* ── TABLES ──────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; padding: 8px 12px;
  font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.6px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 11px 12px; font-size: 13.5px; border-bottom: 1px solid var(--border-lt); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #FAFAF7; }
.tbl .tr-sub td { background: #FAFAF7; font-size: 13px; color: var(--muted); }
.tbl .tr-sub td:first-child { padding-left: 40px; }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress-wrap  { display: flex; align-items: center; gap: 10px; }
.progress-bar   { flex: 1; height: 6px; background: #EDE7DF; border-radius: 3px; position: relative; overflow: visible; }
.progress-fill  { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.progress-mark  { position: absolute; top: -4px; width: 1.5px; height: 14px; background: var(--muted); border-radius: 1px; transform: translateX(-50%); }
.progress-label { font-size: 11.5px; color: var(--muted); min-width: 110px; white-space: nowrap; }
.track-ok       { display: inline-block; margin-left: 4px; font-size: 10px; color: var(--pos); background: rgba(46,125,79,0.1); padding: 1px 6px; border-radius: 10px; }

/* ── PROJECT BADGE ───────────────────────────────────────── */
.proj-badge {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: white;
  flex-shrink: 0; letter-spacing: 0;
}
.proj-name { font-weight: 600; font-size: 13.5px; }
.proj-meta { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 1px; }
.proj-cell { display: flex; align-items: center; gap: 10px; }

/* ── CAT DOT ─────────────────────────────────────────────── */
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ── DELTA ───────────────────────────────────────────────── */
.delta-pos { color: var(--pos); font-weight: 500; }
.delta-neg { color: var(--neg); font-weight: 500; }
.num-right { text-align: right; font-variant-numeric: tabular-nums; }

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-ein   { background: rgba(46,125,79,0.12);  color: var(--pos); }
.badge-aus   { background: rgba(184,50,50,0.12);  color: var(--neg); }
.badge-offen  { background: rgba(196,138,16,0.12); color: var(--warn); }
.badge-ok     { background: rgba(46,125,79,0.12);  color: var(--pos); }
.badge-teilbez{ background: rgba(58,111,168,0.12); color: #3A6FA8; }

/* ── FILTERS BAR ─────────────────────────────────────────── */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters select,
.filters input[type=text] {
  padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--white);
}
.filters input[type=text] { min-width: 180px; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 900;
}
.modal-box {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--white); border-radius: 12px;
  padding: 28px; width: 560px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  z-index: 901;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}
.modal-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-size: 17px; font-weight: 700; }
.modal-x   { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.type-toggle { display: flex; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.tt-btn     { flex: 1; padding: 10px; border: none; background: var(--white); font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--muted); transition: all 0.12s; }
.tt-ein-on  { background: var(--pos); color: white; }
.tt-aus-on  { background: var(--neg); color: white; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.fg         { display: flex; flex-direction: column; gap: 4px; }
.fg.full    { grid-column: 1/-1; }
.fg label   { font-size: 12px; font-weight: 600; }
.fi {
  padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: 6px; font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--white); transition: border-color 0.12s;
}
.fi:focus   { outline: none; border-color: var(--accent); }
textarea.fi { resize: vertical; min-height: 60px; }

/* ── EXPAND TOGGLE (Kreditkarte) ─────────────────────────── */
.expand-btn { background: none; border: none; cursor: pointer; font-size: 11px; color: var(--accent); font-weight: 600; font-family: inherit; padding: 0; }

/* ── PIPELINE STATUS ─────────────────────────────────────── */
.status-lead         { background: #EEE; color: #666; }
.status-angebot      { background: rgba(196,138,16,0.12); color: var(--warn); }
.status-verhandlung  { background: rgba(74,127,168,0.12); color: #3A6FA8; }
.status-gewonnen     { background: rgba(46,125,79,0.12);  color: var(--pos); }
.status-verloren     { background: rgba(184,50,50,0.12);  color: var(--neg); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }

/* ── LOADING ─────────────────────────────────────────────── */
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }

/* ── ACTION BUTTONS ──────────────────────────────────────── */
.btn-edit { background: none; border: 1.5px solid var(--border); padding: 4px 9px; border-radius: 5px; font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-del  { background: none; border: 1.5px solid rgba(184,50,50,0.3); padding: 4px 9px; border-radius: 5px; font-size: 12px; cursor: pointer; color: var(--neg); font-family: inherit; }
.btn-del:hover { background: var(--neg); color: white; }
.actions  { display: flex; gap: 5px; }

/* ── FOOTER MARK ─────────────────────────────────────────── */
.tbl-foot-note { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2,1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page-wrap { padding: 16px; }
}
