:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --border: #d9dee4;
  --accent: #ff4f1f;
  --accent-dark: #d63c10;
  --link: #2a60c8;
  --mark: #ffe58a;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 820px;
}

.user {
  color: var(--muted);
  white-space: nowrap;
}

main {
  padding: 16px 24px 48px;
  max-width: 1200px;
}

.controls {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

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

.label {
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border-radius: 14px;
  background: #e8eef9;
  border: 1px solid #c7d4ee;
}

.chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  color: var(--muted);
}

.queue-add {
  position: relative;
}

.queue-add input {
  width: 200px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 260px;
  max-height: 260px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.suggestions button:hover {
  background: #f0f3f7;
}

.query {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.query:focus {
  outline: 2px solid #9db8ea;
  border-color: #9db8ea;
}

.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.spacer {
  flex: 1;
}

button {
  font: inherit;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button.secondary {
  background: white;
  color: var(--text);
  border-color: var(--border);
}

button.secondary:hover {
  background: #f0f3f7;
}

button.link {
  padding: 0;
  border: none;
  background: none;
  color: var(--link);
}

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

.status {
  color: var(--muted);
}

.status.error,
.error {
  color: #b42318;
}

.progress {
  height: 4px;
  background: #e6e9ee;
  border-radius: 2px;
  overflow: hidden;
}

.progress div {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.card-head h2 {
  flex: 1;
  margin: 0;
  font-size: 16px;
}

.age {
  color: var(--muted);
  white-space: nowrap;
}

.meta {
  color: var(--muted);
}

.meta strong {
  color: var(--text);
}

.pill {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eef0f3;
  color: #3b4754;
}

.pill-waiting-in-queue {
  background: #fff1d6;
  color: #8a5300;
}

.pill-with-agent,
.pill-alerting-agent {
  background: #ddf4e4;
  color: #1c6b37;
}

.pill-parked,
.pill-on-hold,
.pill-in-wrap-up {
  background: #e6e8fb;
  color: #3a3f99;
}

.pill-closed {
  background: #e4e7eb;
  color: #4a5562;
}

.card-closed {
  background: #fbfcfd;
}

.section-head {
  margin-top: 8px;
}

.section-head h3 {
  margin: 0;
  font-size: 15px;
}

.section-head .count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 10px;
  background: #e4e7eb;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.section-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.match {
  border-left: 3px solid var(--border);
  padding: 4px 0 4px 12px;
  display: grid;
  gap: 4px;
}

.match-meta {
  font-size: 12px;
  color: var(--muted);
}

.snippet {
  line-height: 1.45;
}

.attachments {
  font-size: 12px;
  color: var(--muted);
}

.full {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 4px 0;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 420px;
  overflow: auto;
}

.more {
  font-size: 12px;
  color: var(--muted);
}

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

mark {
  background: var(--mark);
  padding: 0 1px;
  border-radius: 2px;
}
