:root {
  --ink: #171717;
  --muted: #6a6862;
  --paper: #fbf8ef;
  --panel: #fffdf6;
  --line: #ded8c8;
  --mint: #7bd6b4;
  --blue: #2f6fed;
  --coral: #ff775f;
  --shadow: 0 18px 50px rgba(28, 25, 18, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 10%, rgba(123, 214, 180, 0.36), transparent 28rem),
    radial-gradient(circle at 92% 0%, rgba(255, 119, 95, 0.2), transparent 22rem),
    linear-gradient(145deg, #fffaf0 0%, #f2efe6 52%, #eaf4ee 100%);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: stretch;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.phone {
  display: grid;
  width: min(100%, 460px);
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-rows: auto 1fr auto;
  border-inline: 1px solid rgba(23, 23, 23, 0.08);
  background: rgba(251, 248, 239, 0.82);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  letter-spacing: 0;
}

.mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--mint);
  box-shadow: 4px 4px 0 var(--ink);
}

.ghost,
.icon {
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 246, 0.76);
  color: var(--ink);
}

.ghost {
  padding: 0 14px;
}

.icon {
  width: 42px;
}

.view {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
  padding: 14px 18px 22px;
}

.hero {
  justify-content: center;
  gap: 24px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 9ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(52px, 18vw, 82px);
  font-weight: 800;
  line-height: 0.86;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1;
}

.lede {
  max-width: 29ch;
  color: #3c3a35;
  font-size: 18px;
  line-height: 1.45;
}

.actions {
  display: grid;
  gap: 12px;
}

.primary {
  min-height: 54px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  font-weight: 800;
  box-shadow: 5px 5px 0 var(--coral);
}

.secondary {
  min-height: 50px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 5px 5px 0 var(--mint);
}

.tiny {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.card {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 8px;
  object-fit: cover;
  background: var(--mint);
}

.name {
  overflow-wrap: anywhere;
  font-size: 22px;
  font-weight: 850;
}

.email {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.qr {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: white;
}

.linkbox {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.linkbox code {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-profile {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.chat {
  gap: 0;
  padding: 0 0 12px;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.messages {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px 18px;
}

.bubble {
  max-width: 82%;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bubble.mine {
  align-self: flex-end;
  background: var(--mint);
}

.bubble.theirs {
  align-self: flex-start;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 10px 18px 0;
}

.composer input {
  min-width: 0;
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: white;
  padding: 0 12px;
}

.composer button {
  width: 52px;
  min-height: 48px;
  border: 1px solid var(--ink);
  background: var(--blue);
  color: white;
  font-weight: 900;
}

.empty {
  margin: auto;
  max-width: 24ch;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

@media (min-width: 720px) {
  .shell {
    padding: 24px;
  }

  .phone {
    min-height: min(820px, calc(100vh - 48px));
    border: 1px solid rgba(23, 23, 23, 0.14);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(28, 25, 18, 0.22);
  }
}

/* ---------- Toegevoegd: inbox, scanner, login met naam, meldingen ---------- */

.brand {
  color: var(--ink);
  text-decoration: none;
}

.top-actions {
  display: flex;
  gap: 8px;
}

a.ghost,
a.icon {
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  text-decoration: none;
}

div.avatar {
  display: grid;
  place-items: center;
  font-weight: 850;
  font-size: 20px;
}

.avatar.small {
  width: 46px;
  height: 46px;
  font-size: 16px;
}

.name-form {
  display: grid;
  gap: 10px;
}

.name-form label {
  font-weight: 800;
}

.name-form input {
  min-height: 50px;
  border: 1px solid var(--ink);
  background: white;
  padding: 0 14px;
  font-size: 17px;
}

.name-form input:focus,
.composer input:focus {
  outline: 3px solid var(--mint);
  outline-offset: 0;
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.button-link {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scan-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--coral);
}

.scan-cta:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--coral);
}

.scan-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--ink);
  font-size: 26px;
}

.scan-cta strong,
.scan-cta small {
  display: block;
}

.scan-cta small {
  color: #cfccc3;
}

.chat-list {
  display: grid;
  gap: 8px;
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}

.chat-row.unread {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--mint);
}

.chat-row-main {
  display: grid;
  min-width: 0;
  flex: 1;
}

.chat-row-name {
  font-weight: 850;
}

.chat-row-last {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row.unread .chat-row-last {
  color: var(--ink);
  font-weight: 700;
}

.chat-row-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--coral);
  color: white;
  font-weight: 850;
}

.bubble {
  display: grid;
  gap: 4px;
}

.bubble time {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

.bubble.mine time {
  color: #2f5d4c;
}

.scanner {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #111;
}

.scanner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid var(--mint);
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}

.install-hint {
  display: grid;
}

.secondary.small {
  min-height: 44px;
  font-size: 15px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--coral);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.phone {
  grid-template-rows: auto 1fr;
}

.view.chat {
  height: calc(100dvh - 70px);
}

@media (min-width: 720px) {
  .view.chat {
    height: calc(min(820px, 100vh - 48px) - 70px);
  }
}
