*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f5f7;
  color: #172b4d;
  min-height: 100vh;
}

/* ── Login scherm ── */
#login-screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: #f4f5f7;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: 48px 40px;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.login-card h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #0052cc;
  margin-bottom: 8px;
}

.login-card p {
  color: #6b778c;
  font-size: .95rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #0052cc;
  color: #fff;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  transition: background .15s;
}
.login-btn:hover { background: #0747a6; }
.login-btn svg { flex-shrink: 0; }

.remember-me {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: .875rem;
  color: #6b778c;
  cursor: pointer;
  user-select: none;
}
.remember-me input { accent-color: #0052cc; cursor: pointer; width: 15px; height: 15px; }

/* ── App ── */
#app { display: none; }

header {
  background: #0052cc;
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

header h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: .01em; }

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

.header-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .875rem;
  transition: background .15s;
}
.header-btn:hover { background: rgba(255,255,255,.25); }
.header-btn:disabled { opacity: .5; cursor: not-allowed; }

#filter-bar {
  background: #fff;
  border-bottom: 1px solid #dfe1e6;
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .875rem;
  color: #42526e;
}

#org-multi .multi-select-btn { min-width: 220px; }

.multi-select { position: relative; display: inline-block; }

.multi-select-btn {
  padding: 5px 10px;
  border: 1px solid #dfe1e6;
  border-radius: 4px;
  font-size: .875rem;
  color: #172b4d;
  background: #fff;
  cursor: pointer;
  min-width: 180px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.multi-select-btn:hover { border-color: #b3bac5; }
.multi-select-btn.open  { outline: 2px solid #4c9aff; border-color: transparent; }
.multi-select-btn .arrow { font-size: .65rem; color: #6b778c; flex-shrink: 0; }

.multi-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid #dfe1e6;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  z-index: 100;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}
.multi-select-dropdown.open { display: block; }

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: .875rem;
  color: #172b4d;
}
.multi-select-option:hover { background: #f4f5f7; }
.multi-select-option input[type=checkbox] { cursor: pointer; accent-color: #0052cc; flex-shrink: 0; }
.org-name-label { flex: 1; cursor: pointer; }
.org-name-label:hover { color: #0052cc; }
.select-all-option { color: #0052cc; font-weight: 600; }
.multi-select-divider { border-top: 1px solid #dfe1e6; margin: 4px 0; }
.dropdown-search {
  padding: 6px 10px;
  border: none;
  border-bottom: 1px solid #dfe1e6;
  font-size: .875rem;
  width: 100%;
  outline: none;
  color: #172b4d;
}
.dropdown-search::placeholder { color: #97a0af; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-new           { background: #97a0af; }
.dot-indeterminate { background: #0052cc; }
.dot-done          { background: #00875a; }

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel-full { grid-column: 1 / -1; }

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

.panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 2px solid #f4f5f7;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.panel-header h2 { font-size: 1rem; font-weight: 600; }

.count-badge {
  background: #dfe1e6;
  color: #42526e;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}

.panel-header.assigned    .count-badge { background: #deebff; color: #0052cc; }
.panel-header.sdm         .count-badge { background: #e3fcef; color: #006644; }
.panel-header.new-tickets .count-badge { background: #fff7d6; color: #974f0c; }

.panel-body { padding: 8px 0; }

.loading, .error-msg, .empty-msg {
  padding: 32px 20px;
  text-align: center;
  color: #6b778c;
  font-size: .9rem;
}
.error-msg { color: #de350b; }

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid #dfe1e6;
  border-top-color: #0052cc;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ticket {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid #f4f5f7;
  transition: background .1s;
}
.ticket:last-child { border-bottom: none; }
.ticket:hover { background: #f8f9fb; }

.ticket-top { display: flex; align-items: flex-start; gap: 10px; }

.issue-type-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.ticket-summary-link {
  font-size: .9rem;
  line-height: 1.4;
  flex: 1;
  color: #172b4d;
  text-decoration: none;
}
.ticket-summary-link:hover { text-decoration: underline; color: #0052cc; }

.ticket-key {
  font-size: .78rem;
  font-weight: 600;
  color: #0052cc;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.ticket-key:hover { text-decoration: underline; }

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.status-new           { background: #dfe1e6; color: #42526e; }
.status-indeterminate { background: #deebff; color: #0052cc; }
.status-done          { background: #e3fcef; color: #006644; }

.priority { display: inline-flex; align-items: center; gap: 4px; color: #6b778c; }
.priority img { width: 14px; height: 14px; }

.person { display: inline-flex; align-items: center; gap: 5px; color: #42526e; }

.avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: #dfe1e6;
  flex-shrink: 0;
}
.avatar-placeholder {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #dfe1e6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  color: #6b778c;
  font-weight: 700;
  flex-shrink: 0;
}

.meta-label { color: #97a0af; font-size: .72rem; }

.updated { margin-left: auto; color: #97a0af; font-size: .72rem; white-space: nowrap; }

/* ── Refresh timer ── */
.refresh-timer {
  font-size: .8rem;
  color: rgba(255,255,255,.6);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
}

/* ── Expand ── */
.expand-bar { padding: 10px 20px; border-top: 1px solid #f4f5f7; text-align: center; }
.expand-btn {
  background: none;
  border: none;
  color: #0052cc;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.expand-btn:hover { background: #f4f5f7; }

/* ── Toaster ── */
#toaster {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: #172b4d;
  color: #fff;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: .875rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  max-width: 340px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast-error   { background: #de350b; }
.toast-success { background: #00875a; }

.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
}
.toast-close:hover { color: #fff; }
