/* ReplyBaas — volledig zelfgehoste styling, geen externe fonts of CDN's */
:root {
  --bg: #0e1014; --card: #171a21; --card2: #1e222c; --line: #262b37;
  --text: #eef1f6; --muted: #9aa3b2; --accent: #8b5cf6; --accent2: #ec4899;
  --ok: #34d399; --warn: #fbbf24; --err: #f87171; --info: #60a5fa;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  min-height: 100vh; font-size: 16px;
}

/* ---------- login / installatie ---------- */
body.auth { display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 26px; text-align: center;
}
.auth-card .logo { font-size: 44px; margin-bottom: 8px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card p { margin-bottom: 18px; }
.auth-card form { text-align: left; }
.auth-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.auth-card input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 16px;
}
.auth-card button {
  width: 100%; margin-top: 18px; padding: 13px; border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.alert {
  background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.4);
  color: #fca5a5; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px;
}
.muted { color: var(--muted); } .tiny { font-size: 12px; margin-top: 14px; }

/* ---------- app-schil ---------- */
#app { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: rgba(14,16,20,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .brand span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill {
  margin-left: auto; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--line); cursor: pointer; user-select: none;
}
.pill.test { background: rgba(251,191,36,.14); color: var(--warn); border-color: rgba(251,191,36,.4); }
.pill.live { background: rgba(52,211,153,.14); color: var(--ok); border-color: rgba(52,211,153,.4); }

main { padding: 16px; max-width: 760px; margin: 0 auto; }
h2 { font-size: 20px; margin-bottom: 4px; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
h3 { font-size: 16px; margin: 20px 0 8px; }

/* ---------- kaarten & tegels ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .num { font-size: 26px; font-weight: 700; }
.tile .lbl { font-size: 12.5px; color: var(--muted); }
.tile.ok .num { color: var(--ok); } .tile.warn .num { color: var(--warn); }
.tile.err .num { color: var(--err); } .tile.info .num { color: var(--info); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--card2); color: var(--muted);
}
.chip.on { color: var(--ok); border-color: rgba(52,211,153,.4); }
.chip.off { color: var(--err); border-color: rgba(248,113,113,.35); }
.chip.click { cursor: pointer; }
.chip.click:active { transform: scale(.96); }

/* ---------- knoppen & invoer ---------- */
button.btn {
  padding: 10px 16px; border: 0; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; background: var(--card2); color: var(--text); border: 1px solid var(--line);
}
button.btn:active { transform: scale(.97); }
button.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: 0; color: #fff; }
button.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
button.btn.danger { color: var(--err); border-color: rgba(248,113,113,.35); }
button.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit;
}
textarea { min-height: 84px; resize: vertical; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* schakelaar */
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: var(--card2); border: 1px solid var(--line);
  border-radius: 99px; transition: .18s; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: var(--muted); top: 3px; left: 3px; transition: .18s;
}
.switch input:checked + i { background: rgba(139,92,246,.35); border-color: var(--accent); }
.switch input:checked + i::after { background: #fff; transform: translateX(20px); }

/* ---------- inbox ---------- */
.comment { padding: 14px 16px; }
.comment .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.comment .who { color: var(--text); font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .3px; }
.badge.nieuw { background: rgba(96,165,250,.15); color: var(--info); }
.badge.beantwoord { background: rgba(52,211,153,.15); color: var(--ok); }
.badge.test { background: rgba(251,191,36,.15); color: var(--warn); }
.badge.afgehandeld, .badge.overgeslagen { background: var(--card2); color: var(--muted); }
.badge.fout { background: rgba(248,113,113,.15); color: var(--err); }
.badge.ig { background: rgba(236,72,153,.15); color: #f472b6; }
.badge.fb { background: rgba(96,165,250,.15); color: var(--info); }
.comment .txt { font-size: 15px; }
.replybox { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.tchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }

/* ---------- telefoon-preview (simulator) ---------- */
.phone {
  background: var(--card2); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 14px; margin-top: 12px;
}
.phone .ph-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.bubble { max-width: 88%; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; margin-bottom: 8px; width: fit-content; }
.bubble .b-who { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.bubble.them { background: #262b37; border-bottom-left-radius: 4px; }
.bubble.me { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble.indent { margin-left: 26px; }
.nomatch { text-align: center; color: var(--muted); padding: 14px 0; font-size: 14px; }

/* ---------- log ---------- */
.logrow { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.logrow:last-child { border-bottom: 0; }
.logrow .l-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.logrow .l-err { color: var(--err); font-size: 13px; margin-top: 4px; }
.logrow .l-msg { color: var(--text); }
.logrow .l-ctx { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- tab-balk onderaan ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: rgba(20,23,29,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0 8px; font-size: 11px; color: var(--muted); cursor: pointer; border: 0; background: none;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tab.active { color: var(--text); }
.tab.active svg { stroke: url(#grad) var(--accent); stroke: var(--accent); }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 760px; max-height: 88vh; overflow-y: auto; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet h3 { margin-top: 0; }
@media (min-width: 700px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 20px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* toast */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom));
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: 90vw;
  opacity: 0; transition: opacity .25s; pointer-events: none; text-align: center;
}
#toast.show { opacity: 1; }
#toast.err { border-color: rgba(248,113,113,.5); color: #fca5a5; }

.demo-banner {
  background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(236,72,153,.25));
  border-bottom: 1px solid var(--line); text-align: center; font-size: 13px; padding: 7px 12px; color: var(--text);
}
code.copy {
  display: block; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; word-break: break-all; margin-top: 4px; cursor: pointer; color: #c4b5fd;
}
.help-step { display: flex; gap: 12px; margin-bottom: 14px; }
.help-step .n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.help-step p { font-size: 14px; color: var(--text); }
.help-step .muted { font-size: 13px; }
details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--card); }
details summary { cursor: pointer; font-weight: 600; font-size: 15px; }
details[open] summary { margin-bottom: 10px; }
