/* Qquest huisstijl: navy, cyaan en rood-oranje (afgeleid van qquest.nl) */
:root {
  --qq-navy: #081e38;
  --qq-navy-2: #232d62;
  --qq-cyan: #36c0f0;
  --qq-red: #f03829;
  --qq-orange: #ff6600;

  --bg: #f5f6f8;
  --panel-bg: #ffffff;
  --text: #081e38;
  --muted: #5b6678;
  --border: #e1e5ec;
  --primary: var(--qq-navy);
  --primary-dark: var(--qq-navy-2);
  --accent: var(--qq-red);
  --accent-dark: #cf2616;
  --danger: #c62828;

  --p1: #d62d20;
  --p2: #ff6600;
  --p3: #e0a800;
  --p4: #2f9e62;
  --status-nog-niet-verstuurd: #8a94a6;
  --status-nieuw: #1a9fd4;
  --status-wachten-op-reactie: #ff6600;
  --status-afgerond: #2f9e62;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(8, 30, 56, 0.06), 0 4px 16px rgba(8, 30, 56, 0.06);
  --focus: 0 0 0 3px rgba(54, 192, 240, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', 'Gotham', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0 0 0.5em 0; color: var(--qq-navy); font-weight: 700; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
a { color: var(--qq-navy-2); }
.muted { color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--panel-bg);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 0 var(--border);
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--qq-cyan) 0 70%, var(--qq-red) 70% 100%);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-title {
  font-weight: 700;
  font-size: 17px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }

.accounts-menu { position: relative; }
.accounts-menu summary { list-style: none; }
.accounts-menu summary::-webkit-details-marker { display: none; }
.accounts-menu summary::after { content: '▾'; font-size: 11px; }
.accounts-menu[open] summary::after { content: '▴'; }
.accounts-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(8, 30, 56, 0.18);
  padding: 6px 4px;
  z-index: 10;
}
.accounts-table { border-collapse: collapse; color: var(--text); white-space: nowrap; }
.accounts-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 14px;
  border-bottom: 2px solid var(--border);
}
.accounts-table td { padding: 7px 14px; border-bottom: 1px solid var(--border); }
.accounts-table tr:last-child td { border-bottom: none; }
.accounts-table code { font-size: 14px; font-weight: 600; }
.accounts-beheren { margin: 8px 10px 4px; }

.teams-table { width: 100%; margin-top: 12px; }
.teams-table td { padding: 8px 6px; }
.teams-table input { width: 100%; padding: 6px 10px; }
.teams-table .team-acties { white-space: nowrap; text-align: right; }
.teams-table .nieuw-team td { border-bottom: none; padding-top: 14px; }

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-header h2 { margin: 0; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 560px; }

/* ---------- Knoppen ---------- */
button, .btn {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .chip:focus-visible, tr.clickable:focus-visible { outline: none; box-shadow: var(--focus); }
button:disabled { opacity: 0.5; cursor: default; }

.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--qq-navy); border-color: var(--qq-navy); }
.btn-secondary:hover { background: var(--qq-navy); color: #fff; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-small { padding: 5px 12px; font-size: 13px; }
.push-right { margin-left: auto; }

.error { color: var(--danger); font-size: 14px; min-height: 18px; margin: 0; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

/* ---------- Formulieren ---------- */
.ticket-form, .login-form { display: flex; flex-direction: column; gap: 14px; }
.ticket-form label, .login-form label, .filters label, .editable-fields label, .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
input, textarea, select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}
input:focus, textarea:focus, select:focus { border-color: var(--qq-cyan); }
.ticket-form textarea { min-height: 110px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Ticketformulier: secties met dezelfde kop, velden in een raster van twee kolommen */
.ticket-form { gap: 0; }
.form-section { padding: 18px 0; border-top: 1px solid var(--border); }
.form-section:first-child { padding-top: 0; border-top: none; }
.form-section-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--qq-navy);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.req { color: var(--accent); }
.ticket-form .error { margin-top: 4px; }

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px dashed #c9d2de;
  border-radius: 8px;
  background: var(--bg);
}
.file-status { flex: 1; min-width: 160px; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.ticket-form .file-btn { flex-direction: row; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--qq-navy); }
.ticket-form .file-btn:hover { color: #fff; }
.file-btn:focus-within { box-shadow: var(--focus); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* ---------- Filters ---------- */
.filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 18px;
}
.filters select { min-width: 150px; }
.filter-count { font-size: 13px; color: var(--muted); align-self: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: #fff;
  color: var(--qq-navy);
  border: 1px solid var(--border);
  padding: 5px 12px;
  font-size: 13px;
}
.chip:hover { background: #eaf7fd; }
.chip.active { background: var(--qq-navy); color: #fff; border-color: var(--qq-navy); }
.chip-count { font-weight: 700; opacity: 0.7; }
.filters:has(.chips) { align-items: center; }

/* ---------- Ticketkaarten ---------- */
/* Elke kaart heeft een eigen kopbalk, rand en schaduw zodat duidelijk is waar een ticket begint en eindigt */
.card {
  border: 1px solid #c9d2de;
  border-radius: 12px;
  padding: 0 20px 18px;
  margin-bottom: 28px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(8, 30, 56, 0.08);
  overflow: hidden;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 -20px 14px;
  padding: 12px 20px;
  background: #e9eef5;
  border-bottom: 1px solid #c9d2de;
  border-top: 4px solid var(--qq-navy);
}
.card-header h3 { margin: 0; font-size: 17px; flex: 1; min-width: 180px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.desc { color: var(--muted); white-space: pre-wrap; margin: 10px 0; }
.melder { font-size: 14px; color: var(--text); }
.melder-extra { color: var(--muted); }
.melder-leeg span { color: var(--muted); font-style: italic; }
.ticket-id { color: var(--qq-cyan); font-weight: 700; font-variant-numeric: tabular-nums; }
.bijlage-link { display: inline-block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.prio-P1 { background: var(--p1); }
.prio-P2 { background: var(--p2); }
.prio-P3 { background: var(--p3); color: #3a2e00; }
.prio-P4 { background: var(--p4); }
.status-nog-niet-verstuurd { background: var(--status-nog-niet-verstuurd); }
.status-nieuw { background: var(--status-nieuw); }
.status-wachten-op-reactie { background: var(--status-wachten-op-reactie); }
.status-afgerond { background: var(--status-afgerond); }
.badge-muted { background: #eef0f6; color: var(--qq-navy-2); }
.badge-open { background: #fff3e0; color: #a14a00; border: 1px dashed var(--qq-orange); }

/* Tabbladen Actief / Archief */
.view-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.view-tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
  padding: 10px 16px;
}
.view-tab:hover { background: transparent; color: var(--qq-navy); }
.view-tab.active { color: var(--qq-navy); border-bottom-color: var(--qq-navy); }

/* Ticket dat bij meerdere teams ligt: teams overleggen wie het doet, de anderen staan het af */
.card.card-open .card-header { border-top-color: var(--qq-orange); background: #fff8ef; }
.shared-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 10px 14px;
  background: #fff8ef;
  border: 1px dashed var(--qq-orange);
  border-radius: 8px;
}
.shared-hint { flex: 1 1 260px; font-size: 14px; color: var(--text); }
.forward-group { display: inline-flex; gap: 8px; align-items: flex-end; margin-left: auto; }

/* Keuze van teams bij versturen naar meerdere teams */
.team-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.ticket-form .check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}
.ticket-form .check:has(input:checked) { border-color: var(--qq-navy); background: #eef2f7; }

.archief-titel { flex: 1 1 200px; }

.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.send-group { display: inline-flex; gap: 6px; margin-left: auto; align-items: center; }
.send-group select { padding: 5px 10px; }

.assignments { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.assignment-row {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fbfcfe;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.assignment-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.assignment-row .team-name { font-weight: 700; }
.ligt-bij, .time { color: var(--muted); font-size: 13px; }
.assignment-buttons { display: flex; gap: 8px; margin-left: auto; }

.assignment-details { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.editable-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  align-items: flex-end;
}
.editable-fields input, .editable-fields select { padding: 6px 10px; }

.unread-badge {
  background: var(--qq-red);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.6; } }

/* ---------- Chat ---------- */
.chat-panel { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 12px; width: 100%; }
.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.chat-message { padding: 8px 12px; border-radius: 10px; background: #eef1f7; border-left: 3px solid transparent; }
.chat-message.trainer { background: #e8f6fd; border-left-color: var(--qq-cyan); }
.chat-message.team { background: #eef0f6; border-left-color: var(--qq-navy); }
.chat-message.systeem { background: transparent; border: 1px dashed var(--border); font-size: 13px; color: var(--muted); }
.chat-meta { display: flex; justify-content: space-between; gap: 8px; }
.chat-message .sender { font-weight: 700; color: var(--qq-navy); }
.chat-message.systeem .sender { color: var(--muted); }
.chat-message .time { font-size: 12px; }
.chat-message p { margin: 4px 0 0 0; white-space: pre-wrap; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; min-height: 44px; resize: vertical; }

/* ---------- Ticket database tabel ---------- */
.table-wrap { overflow-x: auto; }
.template-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.template-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
}
.template-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.template-table tr.clickable { cursor: pointer; }
.template-table tr.clickable:hover { background: #f3fbfe; }
.titel-cell { font-weight: 600; }
.actions-col { text-align: right; white-space: nowrap; }
.actions-col button { margin-left: 6px; }

/* ---------- Modal ---------- */
.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(8, 30, 56, 0.3);
  color: var(--text);
}
.modal::backdrop { background: rgba(8, 30, 56, 0.55); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-close, .toast-close {
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  padding: 2px 8px;
}
.modal-close:hover, .toast-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px 24px; max-height: calc(100vh - 120px); overflow-y: auto; }

/* ---------- Notificaties ---------- */
.toasts {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(8, 30, 56, 0.18);
  border-left: 4px solid var(--qq-cyan);
  font-size: 14px;
  animation: toast-in 0.25s ease;
}
.toast-popup { border-left-color: var(--qq-red); padding: 14px; font-weight: 600; }
.toast-icon {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: var(--qq-cyan);
}
.toast-popup .toast-icon { background: var(--qq-red); }
.toast-text { flex: 1; }
.toast-hide { opacity: 0; transform: translateX(20px); transition: all 0.25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }

.empty { color: var(--muted); font-style: italic; }
.empty.small { font-size: 13px; margin: 0; }
.hidden { display: none !important; }

/* ---------- Inlogpagina ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 15% 20%, rgba(54, 192, 240, 0.18), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(240, 56, 41, 0.12), transparent 40%),
    var(--bg);
}
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 860px;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(8, 30, 56, 0.15);
}
.login-hero {
  position: relative;
  background: var(--qq-navy);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.login-hero h2 { color: #fff; font-size: 26px; line-height: 1.25; }
.login-hero p { color: rgba(255, 255, 255, 0.75); margin: 0; }
.hero-accent {
  position: absolute;
  top: 40px; left: 40px;
  width: 64px; height: 64px;
  border-top: 12px solid var(--qq-cyan);
  border-right: 12px solid var(--qq-red);
  transform: rotate(45deg);
  border-radius: 4px;
}
.login-box { padding: 40px; }
.login-logo { height: 44px; width: auto; display: block; margin-bottom: 20px; }
.login-box h1 { font-size: 24px; margin-bottom: 4px; }
.login-welcome { color: var(--muted); margin: 0 0 22px; }
.login-form button, .login-centrum-btn { justify-content: center; margin-top: 4px; padding: 11px 18px; }
.tabs {
  display: flex;
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: 999px;
  padding: 4px;
}
.tab { flex: 1; justify-content: center; background: transparent; color: var(--muted); border: none; }
.tab:hover { background: rgba(8, 30, 56, 0.06); }
.tab.active { background: var(--qq-navy); color: #fff; }

@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 24px 24px; min-height: 0; }
  .hero-accent { display: none; }
  .login-hero h2 { font-size: 20px; }
  .login-box { padding: 28px 24px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .brand-title { font-size: 15px; }
  #welcome { display: none; }
  .panel { padding: 18px 16px; }
  .send-group { margin-left: 0; }
  .assignment-buttons { margin-left: 0; }
  .push-right { margin-left: 0; }
}
