.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog {
  width: min(1080px, 96vw);
  height: min(720px, 92vh);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.title {
  font-weight: 600;
  color: var(--fg-primary);
  flex-shrink: 0;
}

.searchRow {
  display: flex;
  gap: 8px;
  flex: 1;
  align-items: center;
}

.searchInput {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-primary);
  color: var(--fg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--font-sm);
}

.filterCheck {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--fg-secondary);
  font-size: var(--font-xs);
}

.filterSelect {
  background: var(--bg-primary);
  color: var(--fg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  padding: 3px 6px;
}

.closeBtn {
  background: none;
  border: none;
  color: var(--fg-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 0 6px;
}

.closeBtn:hover {
  color: var(--fg-primary);
}

.body {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}

.sessionList {
  border-right: 1px solid var(--border);
  overflow: auto;
  background: var(--bg-secondary);
}

.sessionRow {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg-primary);
  cursor: pointer;
  font: inherit;
}

.sessionRow:hover {
  background: var(--bg-hover);
}

.sessionRowActive {
  background: color-mix(in srgb, var(--accent, #3b82f6) 15%, transparent);
}

.sessionId {
  font-family: var(--font-mono);
  font-size: var(--font-xs);
  color: var(--fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sessionMeta {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: var(--fg-tertiary);
  margin-top: 3px;
}

.sessionMetaErr {
  color: var(--err);
}

.detailPane {
  overflow: auto;
  padding: 12px 16px;
}

.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--fg-tertiary);
  font-size: var(--font-sm);
  padding: 24px;
  text-align: center;
}

.cmdCard {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  font-family: var(--font-mono);
  font-size: var(--font-xs);
}

.cmdHeader {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.badgeOk {
  background: color-mix(in srgb, var(--ok, #2ea043) 20%, transparent);
  color: var(--ok, #2ea043);
}

.badgeErr {
  background: color-mix(in srgb, var(--err, #d73a49) 20%, transparent);
  color: var(--err, #d73a49);
}

.badgeInferred {
  background: var(--bg-hover);
  color: var(--fg-tertiary);
}

.badgeTui {
  background: color-mix(in srgb, var(--accent, #3b82f6) 20%, transparent);
  color: var(--accent, #3b82f6);
}

.cmdText {
  color: var(--fg-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copyBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
}

.copyBtn:hover {
  color: var(--fg-primary);
  background: var(--bg-hover);
}

.intent {
  color: var(--accent);
  font-style: italic;
  margin-bottom: 4px;
}

.meta {
  color: var(--fg-tertiary);
  font-size: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.snippet {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg-secondary);
  max-height: 140px;
  overflow: auto;
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: var(--font-xs);
  color: var(--fg-tertiary);
  display: flex;
  justify-content: space-between;
  background: var(--bg-secondary);
}
