:root {
  --blue: #3140e6;
  --blue-dark: #2531b8;
  --ink: #1c1c1e;
  --muted: #6b6f76;
  --line: #d9dbe0;
  --screen-bg: #b4b6ba;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2c31;
  padding: 24px;
  color: var(--ink);
}

.phone {
  width: 390px;
  height: 800px;
  max-height: 94vh;
  background: var(--screen-bg);
  border-radius: 38px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 10px #16171a;
  padding: 14px;
  overflow: hidden;
}

.screen {
  width: 100%;
  height: 100%;
  border-radius: 26px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--screen-bg);
  position: relative;
}
.screen::-webkit-scrollbar { width: 0; }

.pad { padding: 26px 22px 40px; }

/* Typography */
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.3px; }
h2 { font-size: 21px; font-weight: 500; color: #2c2c2e; }
.subtle { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

/* Top nav */
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 4px;
}
.back {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.back:hover { opacity: 0.7; }
.nav-spacer { flex: 1; }

/* Header bar (blue project banner) */
.banner {
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  font: inherit;
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.1); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-block { display: block; width: 100%; }
.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* Inputs */
label.field { display: block; margin-bottom: 16px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

/* Dropdown (custom select) */
.combo { margin-bottom: 18px; }
.combo-label { font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.combo-control {
  display: flex;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.combo-value {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  cursor: pointer;
}
.combo-value.placeholder { color: var(--muted); }
.combo-more {
  width: 46px;
  border-left: 1px solid var(--line);
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: #555;
}
.combo-menu {
  margin-top: 6px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.combo-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.combo-menu button:last-child { border-bottom: none; }
.combo-menu button:hover { background: #f5f6f8; }
.combo-menu button.new { color: var(--blue); }

/* Project list */
.project-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.project-bar {
  border: none;
  border-radius: 9px;
  padding: 15px 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.06s ease;
}
.project-bar:hover { transform: translateX(2px); }
.project-bar.archived { opacity: 0.45; }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 6px;
}
.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #ddd;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; color: #555;
}
.avatar-wrap { text-align: center; }
.avatar-wrap .name { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Factor rows on project detail */
.factor-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}
.factor-badge {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  cursor: pointer;
}
.factor-badge.lg { width: 64px; height: 64px; font-size: 34px; }

/* Slider track with ticks */
.slider-block { margin: 22px 0 26px; }
.slider-block .slabel { font-size: 15px; margin-bottom: 6px; }
.slider-mini { flex: 1; }
.slider-mini .slabel { display: none; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: #1c1c1e;
  border-radius: 2px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #999;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #999;
}
.ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  padding: 0 1px;
}

.factor-score {
  margin-left: auto;
  font-size: 40px;
  font-weight: 300;
  color: #fff;
}
.factor-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 30px;
}
.factor-head .fname { font-size: 18px; }

.meta-line { font-size: 14px; color: #2c2c2e; margin: 4px 0; }

/* People */
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 2px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  font-size: 16px;
}
.person-row button {
  background: none; border: none; color: #b00; cursor: pointer; font-size: 18px;
}

.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 14px; }

.toast {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,22,0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

.hint {
  background: rgba(255,255,255,0.45);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #333;
  margin-top: 14px;
  line-height: 1.5;
}

/* Kleiner Abschnitts-Titel über Eingaben */
.field-label {
  font-size: 13px;
  color: var(--muted);
  margin: 18px 0 8px;
  font-weight: 500;
}

/* Segmented control (zwei Optionen) */
.seg {
  display: flex;
  background: #e7e8ec;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 12px;
}
.seg button {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 9px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Schalter (Pro bono) */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  margin: 6px 0 18px;
  cursor: pointer;
}
.switch input { width: 20px; height: 20px; accent-color: var(--blue); cursor: pointer; }

/* Gesperrte R-Felder bei Pro bono */
.is-disabled { opacity: 0.4; pointer-events: none; }

/* R-Berechnungsbox */
.r-calc {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 18px;
  box-shadow: var(--shadow);
}
.r-calc.muted { color: var(--muted); font-size: 13.5px; box-shadow: none; background: rgba(255,255,255,0.5); }
.r-calc-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  padding: 5px 0;
  color: #2c2c2e;
}
.r-calc-line span { color: var(--muted); }
.r-calc-line b { font-weight: 600; }
.r-calc-sep { height: 1px; background: var(--line); margin: 8px 0; }
.r-calc-line.total { margin-top: 4px; font-size: 16px; }
.r-calc-line.total b { font-size: 22px; color: var(--blue); }

/* R-Zeile in der Projekt-Übersicht (nicht ziehbar) */
.r-readout { flex: 1; display: flex; align-items: baseline; gap: 10px; }
.r-readout .r-val { font-size: 22px; font-weight: 600; }
.r-readout .r-cap { font-size: 12px; color: var(--muted); }
.r-readout.muted { color: var(--muted); font-size: 14px; }

/* Vergleich Schätzung → Ist (evaluiertes Projekt) */
.compare-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 2px;
  padding: 0 4px 0 60px;
}
.compare {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 24px;
  font-weight: 600;
}
.compare .c-est { color: var(--muted); }
.compare .c-arrow { color: var(--muted); font-size: 18px; }
.compare .c-ist { font-size: 28px; }
.compare.up .c-ist { color: #2e9e44; }
.compare.down .c-ist { color: #c8324b; }
.compare.same .c-ist { color: var(--ink); }
