/* NEVARO — huisstijl van de klant-voorkant.
 * Alles wat met kleur en vorm te maken heeft staat hier bovenaan als variabele,
 * zodat de huisstijl per klant aan te passen is zonder de rest aan te raken.
 * Geen externe lettertypes of scripts: alles komt van de eigen server (privacy). */

:root {
  --accent: #1F6F5C;
  --bg: #F7F6F3;
  --surface: #FFFFFF;
  --surface-2: #F1EFEA;
  --ink: #17191C;
  --ink-soft: #5C6167;
  --ink-faint: #8B9096;
  --line: #E5E2DC;
  --shadow: 0 1px 2px rgba(20, 22, 26, .05), 0 8px 24px rgba(20, 22, 26, .05);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0F1113;
  --surface: #17191C;
  --surface-2: #1D2024;
  --ink: #ECEDEE;
  --ink-soft: #A2A7AD;
  --ink-faint: #7C8188;
  --line: #262A2F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.screen { height: 100%; }

/* ------------------------------------------------------------ woordmerk */

.wordmark { display: flex; flex-direction: column; gap: 2px; }

/* Merkteken + naam naast elkaar. Het merkteken erft de huisstijlkleur
   (currentColor), dus per klant mee te kleuren zonder het logo aan te raken. */
.lockup { display: flex; align-items: center; gap: 12px; }
.lockup--stack { gap: 14px; }

.mark {
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--accent);
}
.mark--lg { width: 38px; height: 38px; }
.mark--xl { width: 52px; height: 52px; }

.wordmark__name {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink);
}

.wordmark__tag {
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.wordmark--lg .wordmark__name { font-size: 1.6rem; letter-spacing: .26em; }
.wordmark--lg .wordmark__tag { font-size: .7rem; }
.wordmark--xl .wordmark__name { font-size: 2.1rem; letter-spacing: .3em; }
.wordmark--xl .wordmark__tag { font-size: .78rem; }

/* ------------------------------------------------------------ inloggen */

.login {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise .4s ease both;
}

.login__card .lockup { margin-bottom: 16px; }

.login__label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.login__input {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.login__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
}

.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover { background: var(--surface-2); }

.login__error {
  margin: 0;
  font-size: .85rem;
  color: #B4232A;
}
html[data-theme="dark"] .login__error { color: #FF8A8A; }

.login__hint {
  margin: 6px 0 0;
  font-size: .74rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------- de app */

.app {
  display: grid;
  grid-template-columns: 272px 1fr;
  height: 100%;
}

/* zijkant */

.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 14px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.side__top { padding: 0 6px; }

.side__new {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  font-size: .9rem;
}

.plus {
  font-size: 1.15rem;
  line-height: 1;
  color: var(--accent);
}

/* zoeken in gesprekken (filtert de lijst hieronder) */

.side__search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 8px 0 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}

.side__search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.side__search svg {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.side__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: .85rem;
  color: var(--ink);
  padding: 9px 0;
}

.side__search input::placeholder { color: var(--ink-faint); }
.side__search input::-webkit-search-cancel-button { display: none; }

.side__search-clear {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.side__search-clear:hover { color: var(--ink); }

/* Geen treffer bij het zoeken: zeg dat, in plaats van een lege lijst. */
/* De lege-lijst-boodschap wordt door de voorkant zelf gezet (die weet of er op
   titel of op inhoud is gezocht), dus hier geen tekst meer. */

.side__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.chatitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: .875rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.chatitem:hover { background: var(--surface-2); color: var(--ink); }

.chatitem--active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--ink);
  font-weight: 550;
}

.chatitem__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chatitem__time {
  font-size: .7rem;
  color: var(--ink-faint);
  flex: none;
}

/* Etiket bij gesprekken uit een ander kanaal (WhatsApp, Main Chat, automatisch):
   die horen bij het geheugen van de assistent en zijn hier niet te verwijderen —
   vandaar het etiket en geen ×. */
.chatitem__badge {
  flex: none;
  font-size: .6rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0 .34rem;
  line-height: 1.55;
  opacity: .8;
}

.chatitem__del {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, color .12s;
}

.chatitem:hover .chatitem__del { opacity: 1; }
.chatitem__del:hover { color: #B4232A; }

/* Punaise: alleen zichtbaar als je er met de muis overheen gaat (net als het
   verwijderknopje), behalve op een telefoon — daar is er geen zweven, dus staat
   hij altijd aan, anders kun je nooit vastpinnen. */
.chatitem__pin {
  flex: none;
  border: 0;
  background: transparent;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0;
  color: var(--ink-faint);
  transition: opacity .12s, color .12s;
}

.chatitem__pin svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chatitem:hover .chatitem__pin { opacity: 1; }
.chatitem__pin:hover { color: var(--accent); }
.chatitem__pin.is-on { opacity: 1; color: var(--accent); }
.chatitem__pin.is-on svg { fill: color-mix(in srgb, var(--accent) 25%, transparent); }

/* Main Chat en WhatsApp staan altijd vast: de pin is altijd zichtbaar en niet
   aanklikbaar (de server weigert losmaken ook, met een nette melding). */
.chatitem__pin.is-vast { opacity: 1; cursor: default; }
.chatitem__pin:disabled { cursor: default; }

@media (hover: none) {
  .chatitem__pin, .chatitem__del { opacity: 1; }
}

/* Kopjes boven de groepen in de gesprekkenlijst. */
.side__group {
  padding: 10px 10px 4px;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.side__none {
  padding: 10px;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

.side__list--empty::after {
  content: "Nog geen gesprekken. Begin met \2018Nieuwe chat\2019.";
  display: block;
  padding: 10px;
  font-size: .8rem;
  color: var(--ink-faint);
}

.side__foot { border-top: 1px solid var(--line); padding-top: 8px; }

.linkbtn {
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
  font-size: .8rem;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
  width: 100%;
  text-align: left;
}

.linkbtn:hover { color: var(--ink); background: var(--surface-2); }

/* Kort bericht onderin de lijst (bijvoorbeeld "3 gesprekken uit de lijst gehaald"). */
.side__note {
  margin: 0 0 2px;
  padding: 4px 10px;
  font-size: .78rem;
  color: var(--accent);
}

/* hoofdkolom */

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.topbar__title {
  flex: 1;
  min-width: 0;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* Knoppen in de topbalk: thema en gesprek opslaan. Altijd zichtbaar (de
   hamburger hiernaast is de enige die alleen op mobiel bestaat). */
.topbtn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.topbtn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.topbtn:disabled { opacity: .35; cursor: default; }
.topbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.topbtn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Het pictogram laat zien waar je naartoe gaat, niet waar je bent:
   in het licht staat de maan (klik = donker), in het donker de zon. */
html[data-theme="light"] .topbtn__sun { display: none; }
html[data-theme="dark"] .topbtn__moon { display: none; }

.topbtn.is-done { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.topbtn.is-failed { color: #B4232A; }

.iconbtn {
  display: none;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  align-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.iconbtn span {
  display: block;
  width: 15px;
  height: 1.5px;
  background: var(--ink-soft);
  border-radius: 2px;
}

/* gesprek */

.thread {
  min-height: 0;
  overflow-y: auto;
  /* Bewust NIET 'smooth': tijdens het meekruipen moet het scherm direct volgen,
     en een klant die zelf omhoog scrolt mag niet teruggetrokken worden. */
  scroll-behavior: auto;
  padding: 0 20px;
}

.welcome {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 40px 0 60px;
}

.welcome__line {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.msgs {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.msg { animation: rise .25s ease both; }

.msg--user {
  align-self: flex-end;
  max-width: 80%;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg--assistant { align-self: stretch; color: var(--ink); }

/* Kopiëren van een antwoord. Op een muis verschijnt hij bij hover, op een
   aanraakscherm staat hij altijd aan (anders is er geen weg om bij te komen). */
.msg__tools { display: flex; gap: 6px; margin-top: 8px; }

.copybtn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-faint);
  font: inherit;
  font-size: .74rem;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, color .12s, background .15s, border-color .15s;
}

.msg--assistant:hover .copybtn,
.copybtn:focus-visible { opacity: 1; }

@media (hover: none) { .copybtn { opacity: 1; } }

.copybtn:hover { background: var(--surface-2); color: var(--ink); }
.copybtn.is-done { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.copybtn.is-failed { color: #B4232A; border-color: color-mix(in srgb, #B4232A 35%, var(--line)); }

.msg__body > *:first-child { margin-top: 0; }
.msg__body > *:last-child { margin-bottom: 0; }
.msg__body p { margin: 0 0 .85em; }
.msg__body h1, .msg__body h2, .msg__body h3 {
  margin: 1.3em 0 .5em;
  font-size: 1.02rem;
  letter-spacing: .01em;
}
.msg__body ul, .msg__body ol { margin: 0 0 .85em; padding-left: 1.3em; }
.msg__body li { margin: .25em 0; }
.msg__body a { color: var(--accent); text-underline-offset: 2px; }
.msg__body code {
  font-family: var(--mono);
  font-size: .87em;
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: 5px;
}
.msg__body pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 .9em;
}
.msg__body pre code { background: none; padding: 0; font-size: .84em; line-height: 1.55; }
.msg__body blockquote {
  margin: 0 0 .9em;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  color: var(--ink-soft);
}
.msg__body hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.msg__body table { border-collapse: collapse; margin: 0 0 .9em; font-size: .9em; }
.msg__body th, .msg__body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }

.msg__error {
  font-size: .9rem;
  color: #B4232A;
  background: color-mix(in srgb, #B4232A 7%, transparent);
  border: 1px solid color-mix(in srgb, #B4232A 20%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
}

/* Zelf gestopt is geen fout: rustige grijstint in plaats van rood. */
.msg__note {
  font-size: .88rem;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  display: inline-block;
}
html[data-theme="dark"] .msg__error { color: #FF9B9B; }

.cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -.15em;
  background: var(--accent);
  opacity: .85;
  animation: blink 1s steps(2, start) infinite;
}

/* invoerveld */

.composer {
  padding: 0 20px calc(18px + env(safe-area-inset-bottom));
}

.composer__box {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px 8px 8px 14px;
  transition: border-color .15s, box-shadow .15s;
}

.composer__box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.composer textarea {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  max-height: 190px;
  padding: 8px 0;
}

.composer textarea::placeholder { color: var(--ink-faint); }

.send {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.send svg { width: 20px; height: 20px; fill: #fff; }

.send:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

.send:disabled { opacity: .4; cursor: default; }

.send--stop { background: var(--surface-2); border: 1px solid var(--line); }
.send--stop svg { fill: var(--ink-soft); width: 16px; height: 16px; }
.send--stop:hover { background: var(--line); }

.composer__status {
  max-width: 760px;
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--ink-faint);
  padding-left: 4px;
}

.composer__status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
  flex: none;
}

.composer__hint {
  margin-left: auto;
  font-size: .72rem;
  color: var(--ink-faint);
  opacity: .85;
}

/* Op een telefoon bestaat Ctrl+C niet — daar is de stopknop de weg. */
@media (hover: none) {
  .composer__hint { display: none; }
}

/* mobiel */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 19, .45);
  z-index: 8;
  animation: fade .2s ease both;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .side {
    position: fixed;
    z-index: 9;
    top: 0;
    bottom: 0;
    left: 0;
    width: 82%;
    max-width: 320px;
    transform: translateX(-102%);
    transition: transform .24s ease;
    box-shadow: var(--shadow);
  }

  .app--menu .side { transform: none; }

  .iconbtn { display: flex; }

  .thread { padding: 0 14px; }
  .msgs { padding: 20px 0 30px; gap: 18px; }
  .msg--user { max-width: 92%; }
  .composer { padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
  .wordmark--xl .wordmark__name { font-size: 1.6rem; }
  .mark--xl { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .thread { scroll-behavior: auto; }
}

/* animaties */

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* scrollbalk */

.thread::-webkit-scrollbar, .side__list::-webkit-scrollbar { width: 10px; }
.thread::-webkit-scrollbar-thumb, .side__list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink-faint) 35%, transparent);
  border: 3px solid transparent;
  border-radius: 8px;
  background-clip: content-box;
}

/* Oude chats opruimen: eigen venster (geen systeemvenster), want de klant moet
   eerst het aantal zien voordat hij klikt. */

.prune {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  max-width: none;
  max-height: none;
}

.prune::backdrop { background: rgba(12, 14, 16, .45); }

.prune__card {
  width: min(430px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 22px 22px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font);
}

.prune__title { margin: 0; font-size: 1.05rem; }

.prune__text {
  margin: 0;
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.5;
}

.prune__row { display: flex; align-items: center; gap: 10px; }

.prune__label { font-size: .86rem; color: var(--ink-soft); }

.prune__select {
  flex: 1;
  font: inherit;
  font-size: .9rem;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.prune__count { margin: 0; font-size: .9rem; min-height: 1.3em; }

.prune__actions { display: flex; justify-content: flex-end; gap: 10px; }
