/* Shakely HQ — design tokens lifted verbatim from the klantenservice app,
   because that IS the existing design system. Do not drift from these. */
:root {
  --bg: #0b0b0c;
  --panel: #141416;
  --panel-2: #1c1c1f;
  --line: #2a2a2e;
  --text: #f2f2f0;
  --muted: #9a9a9f;
  --lime: #C7F52A;
  --hoog: #ff5d5d;
  --middel: #ffc94d;
  --laag: #6fe07a;
  --radius-btn: 6px;
  --radius-block: 10px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 600px;
  min-height: 100dvh;
}

button { font-family: inherit; }
button:disabled { opacity: .6; cursor: wait; }
input:focus, textarea:focus, button:focus-visible {
  outline: none;
  border-color: var(--lime);
}

/* ---------- Pin screen ---------- */
.pin-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}
.pin-logo { height: 54px; width: auto; opacity: .95; }
.pin-title { font-size: 15px; color: var(--muted); letter-spacing: .3px; }
.pin-input {
  width: 168px;
  padding: 14px;
  font-size: 26px;
  text-align: center;
  letter-spacing: 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pin-error { color: var(--hoog); font-size: 13px; min-height: 18px; }
.keypad { display: grid; grid-template-columns: repeat(3, 68px); gap: 10px; }
.keypad button {
  height: 58px;
  font-size: 20px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.keypad button:active { background: var(--panel-2); }
.keypad .spacer { visibility: hidden; }

/* ---------- App chrome ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar img { height: 26px; width: auto; }
.topbar .spacer { margin-left: auto; }
.topbar .status { font-size: 12px; color: var(--muted); }

.tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tab .badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--lime);
  color: var(--bg);
  font-size: 11px;
  font-weight: 800;
}
.tab.active .badge { background: var(--bg); color: var(--lime); }

.module-host { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Shared building blocks ---------- */
.state {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.state .err { color: var(--hoog); }

.btn {
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn-primary {
  background: var(--lime);
  color: #0b0b0c;
  border-color: var(--lime);
}
.btn-ghost { background: transparent; }

.field {
  width: 100%;
  padding: 11px 14px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-block);
  font-size: 14px;
}
.field::placeholder { color: var(--muted); }

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.action-msg { font-size: 13px; color: var(--muted); min-height: 18px; }
.action-msg.ok { color: var(--laag); }
.action-msg.err { color: var(--hoog); }

/* ---------- Generic list module (taken, boodschappen) ---------- */
.list-pane { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.composer { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.composer .field { flex: 1; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-block);
}
.item.done { opacity: .5; }
.item.done .item-title { text-decoration: line-through; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.item-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--bg);
  font-size: 13px;
  padding: 0;
}
.item-check.on { background: var(--lime); border-color: var(--lime); }
.item-del {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
}
.item-del:hover { color: var(--hoog); }

.prio-hoog { color: var(--hoog); }
.prio-middel { color: var(--middel); }
.prio-laag { color: var(--laag); }

/* ---------- Chat (Instagram module) ---------- */
.chat-pane {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: var(--radius-block);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble-user {
  align-self: flex-end;
  background: rgba(199,245,42,0.1);
  border: 1px solid rgba(199,245,42,0.35);
}
.bubble-agent {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.bubble-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 4px;
}
.bubble img {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
}
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; padding: 6px 2px; }

.pending-card {
  margin: 0 14px 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--lime);
  border-radius: var(--radius-block);
}
.pending-card img { display: block; max-width: 100%; border-radius: 8px; margin-bottom: 10px; }
.pending-card .cap { font-size: 13px; color: var(--muted); margin-bottom: 10px; white-space: pre-wrap; }

/* ---------- Trends ---------- */
.trends-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.trends-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }

/* ---------- Klantenservice split ---------- */
.split { flex: 1; display: flex; min-height: 0; }
.split .list {
  width: 340px;
  flex: 0 0 340px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.split .detail { flex: 1; overflow-y: auto; padding: 16px; }
.case {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.case:hover { background: var(--panel); }
.case.selected {
  background: var(--panel-2);
  border-left: 3px solid var(--lime);
  padding-left: 15px;
}
.case-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.case-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-time { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.case-subject {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.hoog { background: var(--hoog); }
.dot.middel { background: var(--middel); }
.dot.laag { background: var(--laag); }

.filters { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.filter {
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.search-box { flex: 1; min-width: 140px; padding: 7px 14px; border-radius: var(--radius-pill); background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 13px; }

.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-block); padding: 12px 14px; margin-bottom: 12px; }
.block-label { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.block-label.ai { color: var(--lime); }
.conversation { display: flex; flex-direction: column; gap: 10px; }
.turn { max-width: 88%; padding: 10px 12px; border-radius: var(--radius-block); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-shop { align-self: flex-end; background: rgba(199,245,42,0.1); border: 1px solid rgba(199,245,42,0.3); }
.turn-klant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.turn-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.answer-box {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-block);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.answer-box.expanded { min-height: 400px; }
.mobile-back { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  /* Prevent iOS zoom-on-focus. */
  .field, .search-box, .answer-box, .pin-input { font-size: 16px; }

  .split { flex-direction: column; }
  .split .list, .split .detail { width: auto; flex: 1; max-height: none; }
  .split.view-list .detail { display: none; }
  .split.view-detail .list { display: none; }
  .split.view-detail .mobile-back { display: block; }

  .mobile-back {
    background: none;
    border: none;
    color: var(--lime);
    font-size: 13px;
    padding: 10px 14px;
    cursor: pointer;
  }
  .bubble { max-width: 94%; }
  .keypad { grid-template-columns: repeat(3, 74px); }
}
