/* ─── Top bar ─── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#topbar h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  background: rgba(255, 95, 5, 0.15);
  color: var(--accent);
  border-radius: 6px;
  border: 1px solid rgba(255, 95, 5, 0.2);
}

/* ─── Domain filter bar ─── */
#domain-filter-area {
  flex: 1;
  margin: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#topic-input {
  flex: 1;
  min-width: 0;
  max-width: 310px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .78rem;
  outline: none;
  transition: border-color .2s;
}

#topic-input:focus {
  border-color: var(--accent);
}

#topic-input.has-selection {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 95, 5, 0.2);
}

#topic-input::placeholder {
  color: var(--text-dim);
}

#domain-btn-wrap {
  position: relative;
  flex-shrink: 0;
}

#domain-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

#domain-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

#domain-btn.has-filter {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 95, 5, .08);
  box-shadow: 0 0 0 2px rgba(255, 95, 5, .2);
}

#domain-caret {
  font-size: .65rem;
  transition: transform .2s;
}

#domain-btn.open #domain-caret {
  transform: rotate(180deg);
}

#domain-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  max-height: 340px;
  display: none;
  flex-direction: column;
  background: rgba(19, 41, 75, 0.55);
  border: 1px solid rgba(44, 78, 138, 0.4);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 2000;
  overflow: hidden;
}

#domain-dropdown.open {
  display: flex;
}

#domain-clear-btn {
  flex-shrink: 0;
  margin: 8px 8px 4px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: .7rem;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}

#domain-clear-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#domain-list {
  overflow-y: auto;
  padding: 4px 8px 8px;
  flex: 1;
}

#domain-list::-webkit-scrollbar {
  width: 4px;
}

#domain-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.domain-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s;
}

.domain-check-item:hover {
  background: var(--surface-2);
}

.domain-check-item.auto-matched {
  background: rgba(255, 95, 5, .07);
}

.domain-check-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1.5px solid rgba(100, 140, 200, 0.3);
  border-radius: 3px;
  background: rgba(29, 59, 107, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all .15s;
}

.domain-check-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.domain-check-item input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  top: -2px;
  left: 1px;
  font-size: 9px;
  color: #fff;
  line-height: 1;
  font-weight: 700;
}

.domain-check-item label {
  cursor: pointer;
  font-size: .72rem;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}

.domain-check-item .domain-label-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.domain-days {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.domain-day-pill {
  font-size: .55rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(44, 78, 138, .45);
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: .02em;
}
