/* ImmoCloud Design-System
 * ------------------------
 * Eine Datei für alle Apps der Plattform. Die Farbwelt stammt aus der
 * bestehenden Abrechnungs-App (Teal #0e7c66, Navy-Sidebar), das Layout aus dem
 * Wildmoser-App-Portal (Bento-Kacheln, weiche Radien, milchige Kopfleiste).
 *
 * Wird von Portal, Kalkulation und Makler unter /static/design.css eingebunden.
 * Nur hier Farben und Abstände ändern — die Apps definieren keine eigenen.
 */

:root {
  --bg: #f2f5f7;
  --surface: #e9eef2;
  --card: #ffffff;

  --text: #1b2733;
  --muted: #5c6b7a;

  --accent: #0e7c66;
  --accent-hover: #0a5f4e;
  --accent-soft: #e6f4f1;
  --accent-bright: #3ecfae;

  --sidebar-bg: #13232e;
  --sidebar-text: #b9c6d0;

  --ok: #1e7c3c;
  --ok-bg: #e8f6ec;
  --warn: #b25000;
  --warn-bg: #fff4e5;
  --err: #c0392b;
  --err-bg: #fdecea;

  --border: #d7e0e7;
  --hairline: rgba(27, 39, 51, 0.09);
  --shadow: 0 4px 24px rgba(19, 35, 46, 0.07);
  --shadow-hover: 0 14px 34px rgba(19, 35, 46, 0.13);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Gerüst ------------------------------------------------------------ */

.wrap { max-width: 1020px; margin: 0 auto; padding: 48px 22px 90px; }
.wrap.breit { max-width: 1340px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 22px; height: 56px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand { font-weight: 700; font-size: 19px; letter-spacing: -.02em; line-height: 1.05; }
.brand span { color: var(--accent); }
.brand small {
  display: block; color: var(--muted); text-transform: uppercase;
  font-size: 10px; letter-spacing: 2px; font-weight: 600; margin-bottom: 1px;
}
.topnav { display: flex; align-items: center; }
.topnav a {
  color: var(--muted); margin-left: 24px; font-size: 14px; transition: color .2s;
}
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a.aktiv { color: var(--accent); font-weight: 600; }

h1 { font-size: 40px; line-height: 1.1; font-weight: 650; letter-spacing: -.022em; margin-bottom: 8px; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 600; }
.sub { color: var(--muted); margin-bottom: 34px; font-size: 18px; letter-spacing: -.01em; }

.card {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.card-titel { font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
              color: var(--muted); font-weight: 600; margin-bottom: 14px; }

/* --- Kacheln ----------------------------------------------------------- */

.grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }

.app {
  display: block; background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 28px; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .4s cubic-bezier(.2,.7,.2,1),
              box-shadow .4s cubic-bezier(.2,.7,.2,1);
}
.app:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); text-decoration: none; }
.app .icon { font-size: 32px; margin-bottom: 16px; line-height: 1; }
.app .name { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.app .desc { color: var(--muted); font-size: 15px; margin-top: 8px; line-height: 1.5; }
.app.gesperrt { opacity: .55; cursor: not-allowed; }
.app.gesperrt:hover { transform: none; box-shadow: var(--shadow); }
.app.leer {
  background: transparent; border: 1px dashed var(--border); box-shadow: none;
  display: flex; align-items: center; gap: 10px; cursor: default;
}
.app.leer:hover { transform: none; box-shadow: none; }
.app.leer .name { font-size: 15px; font-weight: 500; color: var(--muted); }
.app.leer .plus { font-size: 20px; color: var(--border); line-height: 1; }

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

label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: 12px 14px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 16px;
  font-family: inherit; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(14, 124, 102, .15);
}
input[readonly], input:disabled { background: var(--surface); color: var(--muted); }
.feld-hinweis { font-size: 12px; color: var(--muted); margin-top: 5px; }
.feld-gruppe { display: grid; gap: 0 18px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .feld-gruppe.zwei { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .feld-gruppe.drei { grid-template-columns: 1fr 1fr 1fr; } }

/* Eingabefelder der Kalkulation tragen — wie die grauen Zellen der Excel-Mappe —
   eine sichtbare Markierung, damit klar ist, was Eingabe und was Ergebnis ist. */
.eingabe { background: #fbfcfd; border-left: 3px solid var(--accent-bright); }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  border-radius: 980px; padding: 11px 22px; font-size: 16px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: background .2s, transform .1s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--surface); color: var(--text); }
.btn.sec:hover { background: #dde4ea; }
.btn.danger { background: var(--err); }
.btn.danger:hover { background: #a93226; }
.btn.klein { padding: 7px 15px; font-size: 14px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

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

.tabelle-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hairline); }
th { color: var(--muted); font-weight: 600; font-size: 11px;
     text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface); }
tr.summe td { font-weight: 650; border-top: 2px solid var(--border); background: var(--surface); }
.negativ { color: var(--err); }
.positiv { color: var(--ok); }

/* --- Kennzahlen -------------------------------------------------------- */

.kennzahlen { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kennzahl {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 16px 18px;
}
.kennzahl .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kennzahl .wert { font-size: 26px; font-weight: 650; letter-spacing: -.02em;
                  margin-top: 4px; font-variant-numeric: tabular-nums; }
.kennzahl .fuss { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kennzahl.gut { border-left: 3px solid var(--ok); }
.kennzahl.mittel { border-left: 3px solid var(--warn); }
.kennzahl.schlecht { border-left: 3px solid var(--err); }

/* --- Kleinteile -------------------------------------------------------- */

.pill { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 980px;
        background: var(--surface); color: var(--muted); font-weight: 500; }
.pill.gut, .pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.mittel { background: var(--warn-bg); color: var(--warn); }
.pill.schlecht, .pill.off { background: var(--err-bg); color: var(--err); }
.pill.akzent { background: var(--accent-soft); color: var(--accent); }

.flash { padding: 13px 17px; border-radius: 14px; margin-bottom: 16px; font-size: 15px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

.muted { color: var(--muted); font-size: 14px; }
.fussnote { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 26px;
            padding-top: 16px; border-top: 1px solid var(--hairline); }

/* --- Diagramme (reines SVG, keine Fremdbibliothek) --------------------- */

.chart { width: 100%; height: auto; overflow: visible; }
.chart .achse { stroke: var(--border); stroke-width: 1; }
.chart .gitter { stroke: var(--hairline); stroke-width: 1; }
.chart .beschriftung { fill: var(--muted); font-size: 11px; }
.chart .linie { fill: none; stroke: var(--accent); stroke-width: 2.5;
                stroke-linejoin: round; stroke-linecap: round; }
.chart .flaeche { fill: var(--accent); opacity: .10; }
.chart .balken { fill: var(--accent); }
.chart .balken.neg { fill: var(--err); }
.chart .balken.alt { fill: var(--accent-bright); }
.chart .nulllinie { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

/* --- Druck ------------------------------------------------------------- */

@media print {
  .topbar, .actions, .btn { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .app:hover { transform: none; }
}

/* --- Handy ------------------------------------------------------------- */

@media (max-width: 560px) {
  .wrap { padding: 28px 16px 56px; }
  .topbar { position: static; height: auto; flex-direction: column;
            align-items: flex-start; gap: 8px; padding: 13px 16px; }
  .topnav { flex-wrap: wrap; gap: 2px 18px; }
  .topnav a { margin-left: 0; }
  h1 { font-size: 30px; }
  .sub { font-size: 16px; }
  .app { padding: 22px; }
}
