:root {
  --bg: #f4f7fb;
  --card: #fff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --dark: #0f172a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  min-height: 64px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}


.topbar button,
.filters button,
.login-card button,
.modal-card button {
  border: 0;
  background: var(--blue);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
 

.topbar button {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.topbar button:hover {
  background: #2563eb;
  color: white;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}
/* ── Layout ─────────────────────────────────────────────────────────────────── */

.container {
  max-width: 1250px;
  margin: 24px auto;
  padding: 0 18px;
}

/* ── Department tabs (Support / Verkoop) ──────────────────────────────────── */

.dept-tabs {
  max-width: 1250px;
  margin: 18px auto 0;
  padding: 0 18px;
  display: flex;
  gap: 8px;
}

.dept-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  padding: 12px 20px;
  border-radius: 14px 14px 0 0;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 0;
  position: relative;
  top: 1px;
}

.dept-tab.active {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}

/* ── Stat cards ─────────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.card,
.panel,
.login-card,
.thanks-card,
.modal-card,
.feedback-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px #0f172a12;
}

.card {
  padding: 22px;
  text-align: left;
}

.card-click {
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: inherit;
}

.card-click:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px #0f172a1e;
}

/* Icon row inside stat cards */
.card-icon-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Smiley / icon box — bigger */
.card-icon-box {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 32px;   /* larger emoji */
  flex-shrink: 0;
}

.total-icon   { background: #eff6ff; }
.happy-icon   { background: #dcfce7; }
.neutral-icon { background: #fef3c7; }
.sad-icon     { background: #fee2e2; }

.label {
  color: var(--muted);
  font-size: 14px;
}

.number {
  font-size: 36px;
  font-weight: 800;
  margin-top: 4px;
}

.hint {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 12px;
}

.card.happy   { border-left: 6px solid var(--green); }
.card.neutral { border-left: 6px solid var(--orange); }
.card.sad     { border-left: 6px solid var(--red); }
.card.total   { border-left: 6px solid var(--blue); }

/* ── Panels ─────────────────────────────────────────────────────────────────── */

.panel {
  padding: 20px;
  margin-top: 16px;
}

.panel h2 {
  margin: 0 0 8px;
}

.panel canvas {
  max-height: 340px;
}

.chart-canvas-wrap {
  position: relative;
  height: 300px;
  width: 100%;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.small { font-size: 13px; }

/* Utility: replaces inline style="display:none" so CSP can drop 'unsafe-inline' */
.hidden-section { display: none; }

/* Donut chart sizing */
.donut-wrap {
  max-width: 360px;
  margin: 0 auto;
}

/* ── Custom HTML chart legend ─────────────────────────────────────────────
   Chart.js draws its built-in legend on the canvas, so it can't be styled
   with CSS. We hide that legend and build our own below the chart instead —
   this gives us a bigger circular swatch with the emoji centered inside it,
   instead of a small color dot next to the emoji+text. */

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 4px 6px;
  border-radius: 10px;
}

.chart-legend-item:hover { background: #f1f5f9; }

.chart-legend-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chart-legend-swatch.happy   { background: #dcfce7; }
.chart-legend-swatch.neutral { background: #fef3c7; }
.chart-legend-swatch.sad     { background: #fee2e2; }

.chart-legend-label {
  font-weight: 700;
  font-size: 14px;
  color: #334155;
}

.chart-legend-count {
  font-weight: 800;
  font-size: 14px;
  color: #0f172a;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ── Scope buttons ───────────────────────────────────────────────────────────── */

.dashboard-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.scope-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px #0f172a0d;
}

.scope-button.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* ── Filters ─────────────────────────────────────────────────────────────────── */

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.filters-sales {
  grid-template-columns: 2fr 1fr 1fr auto;
}

.filters input,
.filters select,
.login-card input,
.modal-card input,
.modal-card select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}

/* ── Agent autocomplete ──────────────────────────────────────────────────── */

.autocomplete-wrap {
  position: relative;
}

.autocomplete-wrap input {
  width: 100%;
}


.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;

  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;

  max-height: 220px;
  overflow-y: auto;
  z-index: 30;

  padding: 6px;        /* ✅ ruimte rondom items */


}


.autocomplete-list.hidden { display: none; }

.autocomplete-item {
  background: #ffffff !important;
  color: #111827 !important;
}
.autocomplete-item:hover,
.autocomplete-item.active {
  background: #eff6ff;
  color: #1d4ed8;
}

.autocomplete-item mark {
  background: #fde68a;
  color: inherit;
  border-radius: 3px;
}

.autocomplete-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.active-filter {
  display: inline-block;
  margin: 6px 0 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 13px;
}





/* ===== ITEMS ===== */

.autocomplete-item {
  display: block;
  width: 100%;

  padding: 6px 10px;   /* ✅ KLEINER */
  margin-bottom: 4px;  /* ✅ SPACE tussen items */

  background: #ffffff;
  color: #111827;

  font-size: 13px;     /* ✅ compacter */
  border-radius: 6px;

  cursor: pointer;
}

/* laatste item geen extra margin */

.autocomplete-item:last-child {
  margin-bottom: 0;
}

/* hover = subtiel */

.autocomplete-item:hover {
  background: #f3f4f6 !important;
  color: #111827 !important;
}
/* geselecteerd */

.autocomplete-item.active {
  background: #e5e7eb;
  font-weight: 600;
}

/* highlight (onopvallend) */

.autocomplete-item mark {
  background: transparent;
  font-weight: 600;
  color: inherit;
}

/* empty */

.autocomplete-empty {
  padding: 8px 10px;
  color: #6b7280;
  font-size: 12px;
}

.autocomplete-wrap input {
  box-shadow: none !important;
  outline: none !important;
  border: 1px solid #d1d5db;
}


/* ── Table ─────────────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th { background: #f8fafc; }

.tablewrap { overflow: auto; }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f8fafc; }

/* ── Rating pill ─────────────────────────────────────────────────────────────── */

.rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
  font-size: 14px;
}

.rating-pill.happy   { background: #dcfce7; color: #166534; }
.rating-pill.neutral { background: #fef3c7; color: #92400e; }
.rating-pill.sad     { background: #fee2e2; color: #991b1b; }

/* Smiley inside pill (table rows) */
.rating-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 18px;
  background: rgba(255,255,255,0.7);
  flex-shrink: 0;
}

/* ── Detail modal — Beoordeling field ─────────────────────────────────────── */

.detail-rating-cell {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.detail-rating-cell > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}

/* Badge: compact, does NOT fill the whole cell */
.detail-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  width: auto;       /* never full-width */
}

.detail-rating-badge.happy   { background: #dcfce7; color: #166534; }
.detail-rating-badge.neutral { background: #fef3c7; color: #92400e; }
.detail-rating-badge.sad     { background: #fee2e2; color: #991b1b; }

/* Smiley inside the detail badge */
.detail-rating-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 19px;
  background: rgba(255,255,255,0.75);
  flex-shrink: 0;
}

.detail-rating-label {
  font-size: 13px;
  font-weight: 800;
}

/* ── Comment check / empty ────────────────────────────────────────────────── */

.comment-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-weight: 900;
  font-size: 18px;
}

.comment-empty { color: #94a3b8; font-style: italic; }

/* ── Badges (legacy) ─────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.happy   { background: #dcfce7; color: #166534; }
.badge.neutral { background: #fef3c7; color: #92400e; }
.badge.sad     { background: #fee2e2; color: #991b1b; }

.comment-cell { white-space: pre-wrap; max-width: 420px; line-height: 1.45; }

.link-button {
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font: inherit;
  font-weight: 700;
}

.link-button:hover { text-decoration: underline; }

/* ── Agent cards ─────────────────────────────────────────────────────────── */

.agent-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.agent-card {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px #0f172a10;
  transition: 0.15s ease;
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px #0f172a1c;
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.agent-card-header strong { color: #0f172a; }

.agent-card-header span {
  background: #eff6ff;
  color: #1d4ed8;
  padding: 5px 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.agent-bars { display: grid; gap: 10px; }

.agent-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 34px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.agent-bar-row span {
  display: flex;
  align-items: center;
}

.agent-bar-bg {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.agent-bar {
  height: 100%;
  border-radius: 999px;
}

.happy-bar   { background: #22c55e; }
.neutral-bar { background: #f59e0b; }
.sad-bar     { background: #ef4444; }

/* Agent smiley badges */
.agent-smiley {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 6px;
  border-radius: 999px;
  font-size: 17px;
}

.happy-smiley   { background: #dcfce7; }
.neutral-smiley { background: #fef3c7; }
.sad-smiley     { background: #fee2e2; }

/* ── Modal ───────────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: #0008;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal.hidden { display: none; }

.modal-card {
  width: min(430px, 100%);
  padding: 24px;
  max-height: 90vh;
  overflow: auto;
}

.large-modal { width: min(820px, 100%); }

.modal-card input { margin: 8px 0; }

/* ── Gebruikerslijst (Gebruikers-modal) ──────────────────────────────────── */

.users-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  max-height: 220px;
  overflow-y: auto;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}

.user-row .remove-user-btn {
  border: 0;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  padding: 5px 9px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.user-row select {
  width: auto;
  flex: 0 0 auto;
  padding: 6px 8px;
  font-size: 13px;
}

.modal-card h3 {
  margin: 18px 0 4px;
  font-size: 15px;
}

.modal-actions { display: flex; gap: 10px; margin-top: 10px; }

.modal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-title-row h2 { margin: 0; font-size: 18px; }

.icon-btn {
  border: 0;
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 10px;
  font-size: 26px;
  line-height: 1;
  width: 42px;
  height: 42px;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-grid > div:not(.detail-rating-cell) {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.detail-grid > div:not(.detail-rating-cell) > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.detail-grid > div:not(.detail-rating-cell) > strong {
  font-size: 14px;
}

/* Agent: compacter dan de andere velden — kleinere tekst, afgekapt i.p.v. het vak op te rekken */
.detail-agent-cell {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}

.detail-agent-cell > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.detail-agent-cell > strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.full-comment {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  line-height: 1.6;
  max-height: 330px;
  overflow: auto;
}

.large-comment {
  min-height: 160px;
  max-height: 420px;
  font-size: 15px;
  line-height: 1.6;
  padding: 18px;
}

.modal-card h3 {
  margin: 16px 0 8px;
  font-size: 15px;
}

/* ── Login / feedback / thanks pages ──────────────────────────────────────── */

.login-body, .center-body, .feedback-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc 55%, #ecfeff);
}

.login-card, .thanks-card { width: min(430px, 100%); padding: 30px; }
.thanks-card { text-align: center; }
.thanks-card .success-badge,
.thanks-card .info-badge { margin-bottom: 18px; }
.thanks-card h1 { margin: 0 0 8px; }
.thanks-card p { margin: 0 0 6px; }

.brand {
  font-size: 14px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* MODELEC logo, used on every survey-facing form */
.form-logo {
  display: block;
  width: 158px;
  height: auto;
  margin: 0 auto 22px;
}

.muted { color: var(--muted); }
.error { color: #dc2626; min-height: 20px; }
.big-icon { font-size: 64px; }

/* Friendly success badge — circular gradient with a checkmark, used instead
   of a plain emoji on thank-you / already-voted style confirmation screens */
.success-badge {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto;
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 10px 24px #05966944;
}

.success-badge svg { width: 42px; height: 42px; }

.info-badge {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 10px 24px #2563eb44;
}

.rating-badge {
  background: #f8fafc;
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 40px;
}

.warn-badge {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  box-shadow: 0 10px 24px #d9770644;
}

.feedback-card { width: min(680px, 100%); padding: 32px; }
.pretty-feedback { border-top: 7px solid var(--blue); }

.feedback-header {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.feedback-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.feedback-header h1 { margin: 0; }
.subtitle { margin: 5px 0 0; color: var(--muted); }

.case-pill {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 700;
  margin: 4px 0 20px;
}

.comment-box { padding: 18px; background: #f8fafc; border: 1px solid var(--line); border-radius: 16px; }
.comment-box label { font-size: 18px; }
.comment-box .comment-label { display: block; margin-top: 20px; }

.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.name-row input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
}

.feedback-card textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  background: #fff;
}

.char-row { text-align: right; color: #94a3b8; font-size: 12px; margin-top: 5px; }

.feedback-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.feedback-actions button { border: 0; background: var(--blue); color: white; padding: 12px 18px; border-radius: 12px; font-weight: 800; cursor: pointer; }
.feedback-actions button:hover { background: #1d4ed8; }

.skip-link { color: var(--muted); text-decoration: none; }
.skip-link:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 850px) {
  .cards, .filters, .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar button { margin-left: 0; }

  .feedback-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-bar-row {
    grid-template-columns: 1fr;
  }

  .form-logo {
    width: 130px;
    margin-bottom: 18px;
  }

  .login-card, .thanks-card, .feedback-card {
    padding: 22px;
  }

  .name-row {
    grid-template-columns: 1fr;
  }
}
