/* =====================================================================
   Mosaik des Lebens — Mini App Styling
   Nutzt Telegram-Theme-Variablen, mit eigenem Fallback-Farbschema.
   ===================================================================== */
:root {
  --gold:    #b08d57;
  --gold-dk: #8a6d3b;
  --sand:    #f6f1e9;
  --ink:     #2c2a26;
  --muted:   #7a7268;
  --card:    #ffffff;
  --line:    #ece4d7;
  --ok:      #6a8a5f;
  --danger:  #b5583f;
  --bg:      var(--tg-theme-bg-color, var(--sand));
  --text:    var(--tg-theme-text-color, var(--ink));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 72px;
}
h1, h2, h3 { font-weight: 600; line-height: 1.25; }
a { color: var(--gold-dk); }
button { font-family: inherit; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }

/* Kopf */
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, var(--sand), rgba(246,241,233,.85));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.appbar .logo { font-size: 20px; }
.appbar h1 { font-size: 17px; margin: 0; letter-spacing: .3px; }

/* Karten */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Fortschritt */
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dk)); transition: width .4s; }

/* Portal-Schritte */
.step { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.step .num {
  flex: 0 0 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600;
  background: var(--sand); border: 1px solid var(--line); color: var(--muted);
}
.step.done .num { background: var(--ok); color: #fff; border-color: var(--ok); }
.step .t { font-weight: 600; }
.badge {
  display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: #f3ecdd; color: var(--gold-dk); border: 1px solid var(--line); margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-block; border: none; border-radius: 12px; padding: 12px 18px;
  background: var(--gold-dk); color: #fff; font-weight: 600; cursor: pointer; width: 100%;
}
.btn.secondary { background: transparent; color: var(--gold-dk); border: 1px solid var(--gold); }
.btn.ghost { background: var(--sand); color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn:active { transform: translateY(1px); }

input, textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); font-size: 15px; margin-top: 6px;
}
label { font-size: 13px; color: var(--muted); display: block; margin-top: 12px; }
textarea { min-height: 90px; resize: vertical; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 16px; font-size: 15px; }
.bubble.me  { align-self: flex-end; background: var(--gold-dk); color: #fff; border-bottom-right-radius: 4px; }
.bubble.you { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.composer { display: flex; gap: 8px; position: sticky; bottom: 72px; background: var(--bg); padding: 8px 0; }
.composer input { margin: 0; }
.composer .btn { width: auto; padding: 11px 16px; }

.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--sand); }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.pill { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; white-space: nowrap; }
.pill.active { background: var(--gold-dk); color: #fff; border-color: var(--gold-dk); }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }

/* Untere Navigation */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: #fff; border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; border: none; background: none; padding: 10px 4px 12px;
  color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
}
.tabbar button .ic { font-size: 20px; }
.tabbar button.active { color: var(--gold-dk); }

.hidden { display: none !important; }
.center { text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: .95; }
